I'm playing around with an mbed LPC1768 for a project I'm working on. When you upload a new binary to the LPC1768 you have to perform a reset for it to run the updated binary; you can do this with a reset button on the board, or by triggering a soft reset by sending a break signal to a virtual serial port. To speed up my compile-upload-test cycle I wanted to be able to do this from the terminal, on OS X.

You can send a break manually using screen, but I wanted something noninteractive so I could trigger a compile-upload-test with a single command. Turns out it's fairly simple in C:

Compile with gcc -o sendbreak sendbreak.c then run with ./sendbreak /dev/tty.usbmodem622 where /dev/tty.usbmodem622 is the device you want to send the break to.

Don't have gcc? I think for me it came with xcode.


04 January 2014


website@mjt.me.uk · Home · Archive · Tags