Simple Timed UART TX

I want to transmit a byte every one second, with UART12. Is the code below accurate? I have the TX line connected to an MSP430 eval board which is running a loop to echo any received character to the computer screen. 

//start code 
hardware.uart1289.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS);  

function rxtx()
    //send a packet on the output
    imp.wakeup(1, rxtx);


//end code 

I did not notice an imp.configure() - is it part of your code?

The configure is the first line, so that’s OK.  Yes, that should work fine, sending an 0xAA once per second. If you want to be more rigid with the timing put the imp.wakeup at the top of the txtx function, otherwise the period will be 1s plus however long the rest of the function takes to execute. Not really an issue here, but for a more complex function it might be.

Fen Consultants, UK

Well that’s embarrassing! I’ve been putting it at the bottom, so I guess that’s why I didn’t see it.

Hmm, I tried this and it doesn’t seem to be working. I can confirm that the code on the msp430 is fine because I tested it with 2 msp430 boards talking to each other. So there must be something wrong with the squirrel code. 

Your eval board serial port is definitely 3.3V not RS232?

Do you have a scope with which you can probe the tx line to satisfy yourself it’s sending?

Fen Consultants, UK

I’m a tad suspicious of types. Try imp.wakeup(1.0, rxtx) to ensure the period is a float.

…and pin 8 is transmit. Just checking :slight_smile:


I checked Pin 8 with an oscope and it seems to be transmitting at the right frequency. The eval-board  runs at3.3 V and not RS-232. I can confirm that. So still not sure what the problem is. I haven’t had time to play with it recently, should hopefully get to it by next week. 

Word format?  Baud rate?  Flow control disabled on the other side?

Fen Consultants, UK

Solved. I actually had it hooked up to the wrong pin on the msp430 board! It works perfectly fine. Receiving 0xAA every 1 s.