So far, we’ve set up the board.txt
and platforms.txt
files in the IDE to support a new LPC824 µC architecture. It works, as you can see from this screen shot:
But that’s not the whole story. It would be nice if the IDE can also act as “serial monitor”, i.e. connect to the running application and communicate with it using serial I/O over USB.
Well… that’s where things get nasty:
Nothing happens. In fact, the LPC824 isn’t even running while this monitor window is active. The crazy bit: closing the monitor window starts the LPC824 running. Every time!
The explanation is actually quite simple: the RESET pin is tied to “DTR”, which means “Data Terminal Ready”. This is an inverted-logic signal, so DTR will go low when… the data terminal is ready. Keeping the µC permanently in reset, as a result.
This is why all Arduino boards have a 0.1 µF capacitor inserted between the serial DTR pin and the µC’s RESET pin. Since the µC has an internal pull-up active, a high-to-low transition will generate a brief low pulse on RESET, and then it will return to high.
Which is precisely why an Arduino always resets when you open a serial connection to it.
With the FTDI adapter and Tinker Pico so far, this mechanism was entirely done in software: DTR and RESET are tied together, and the uploader
utility then pulses that line under software control. More importantly, when uploader then enters serial terminal mode (with the -s
option), it’ll force DTR to inactive, i.e. high.
So uploader -s
works for serial I/O on a Tinker Pico, but the IDE serial monitor won’t.
First thought of course, is to simply add that 0.1 µF capacitor in there, right?
Unfortunately, that’s not enough: the other pin we use is RTS, which determines whether the µC will enter its ROM boot loader or start normal operation. Well, RTS suffers from the same problem: the IDE serial monitor pulls it low while open, causing the LPC824 µC to enter boot mode, even if we have that capacitor between DTR and RESET.
And we can’t include a second capacitor. The logic would end up wrong.
Conclusion: without modification, the current Arduino IDE’s serial monitor can’t be used for serial I/O. We can compile, upload, and run. But we just can’t connect for serial I/O.
The only way out for now is to use either “uploader -s /dev/...
” outside the IDE, or some other terminal application which can properly leave DTR and RTS inactive (i.e. high). This also means screen
can’t be used: it has the same bad behaviour, at least on Mac OSX.
It’s a major inconvenience, unfortunately. Every time we upload, we’ll need to first quit the terminal session, then upload, then restart the terminal session.
So what we have now, is a very basic add-on for the Arduino IDE to develop and upload LPC824 “sketches”. No ADC, PWM, I2C, SPI, yet – all of these will still have to be added.
And we’re thrown back to a fairly messy way of dealing with serial USB I/O during use.
Maybe it’s time to revisit our whole approach…
[Back to article index]