Release 10 UART Bug

Since upgrading my imp to Release 10 every time the imp wakes up the UART sends a pulse on its TX pin that I’ve measured varying from 13 microseconds up to 110 microseconds. I have a Sparkfun Arduino shield hooked up to an RS-232 convertor and my Computer reads this pulse as ÿ or 0xFF (regardless of the pulse width). I am polling the UART receive buffer using imp.wakeup(0.000001, callBackFunction) to read data as fast as I can when it comes in. The output pulse gets written for every wakeup and ends up flooding my device and breaking the application that I had working with Release 5…

There seems to be something else wrong too… Even when writing a string using the UART buffered output these pulses are still present. I tried using the new uart.write(str) method with “LONG STRING TO OUTPUT!” and my computer received “LOÿNÿGÿ STRIÿNÿG TO OUÿTÿPUT!ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ”… (everything after the exclamation point is because those characters are being written constantly)

Oh dear, it’s glitching every time we rejig the clocks. I’ll look into it.

Peter

Thank you Peter. I’m basically out of commission on this application until this is fixed. (which I guess makes me an eager beta tester once you have a fix in place! :slight_smile: )

…and I worked out why we didn’t see this, which is because we tend to be using serial at high rates (eg, 115200bps) where this length pulse would be seen as a break vs a start bit.

Are you running at 9600?

Yes I am.

If the problem is related to what I think it is, a workaround is to enable RX as well as TX on that UART. (If you’re already enabling this UART for RX then the problem is really not what I think it is.) You don’t have to actually do anything with the RX pin – in fact you can use pin.configure or spi.configure or whatever to make it something else altogether, just so long as the UART thinks it might be getting RX.

Peter

I have TX and RX enabled on my UART connection. I do not have hardware flow control enabled (CTS/RTS). I also checked this morning and the problem persists when using a baud rate of 115,200. Here is my UART configure code if that is helpful.

`constructor(port, u16BaudRate, wordSize, parity, stopBits, ctrlFlags){

    base.constructor(name, type);  
      

    if (port == "UART_57" || port == UART_57) {
    	// Configure UART on pins 5,7
    	serialConn = hardware.uart57;
    }
    else if (port == "UART_1289" || port == UART_1289) {
    	// Configure UART on pins 1,2,8,9
    	serialConn = hardware.uart1289;
    }
    else if (port == "UART_12" || port == UART_12) {
    	// Configure UART on pins 1,2
    	serialConn = hardware.uart12;
    }
    else {
    	// Problem somewhere
    	server.error(format("Invalid UART port specified"));
    	return;
    }
    
    if(parity == "PARITY_NONE")         parity = PARITY_NONE;
    else if(parity == "PARITY_EVEN")    parity = PARITY_EVEN;
    else if(parity == "PARITY_ODD")     parity = PARITY_ODD;
    
    if(ctrlFlags == "NO_TX")            ctrlFlags = NO_TX;
    else if(ctrlFlags == "NO_RX")       ctrlFlags = NO_RX
    else if(ctrlFlags == "NO_CTSRTS")   ctrlFlags = NO_CTSRTS     

    sleepTime = 1.0/(u16BaudRate/(1+wordSize+parity+stopBits));
    
    //Configure UART with Device settings
    serialConn.configure(u16BaudRate, wordSize, parity, stopBits, ctrlFlags);
    flush();
    server.log(format("Created RS232 Terminal object with baud rate %d", u16BaudRate));
}`

This is instantiated using:
var<- classConstructor(UART_12, 9600, 8, PARITY_NONE, 1, NO_CTSRTS);

Here is a sample of what is received at a baud of 115200:
þÿþÿþÿþÿþþÿÿþÿþÿþÿþþþÿþÿþÿþÿþþþÿþÿþþþÿþþþÿþÿþÿþþþþÿþþþþþþþþþþþþþþþþþþ þþþþþþþþþþþþþÿþþþÿþþþÿþþþþÿþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþÿþþþþþÿþþþþþþþþÿþþþ þþþþþþþþþþþþþþþþþþþþÿÿþþþþþþþþþþþÿþþÿÿþþþþþþþþþþþþþþþþþþþþþþÿÿþþþþþþþþþþþþþþþþþþ þþþþþþþÿþþþÿþþþþþþþÿÿÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿþÿÿÿþÿÿÿþÿÿÿþÿþÿþÿþÿÿÿþÿþÿþÿþÿ ÿÿþÿþÿþÿþÿþÿþÿþÿþÿþÿÿÿþÿþÿÿÿþÿÿÿþÿþÿþÿþÿÿÿÿÿÿÿÿÿþÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿþÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿþþÿÿÿÿÿÿÿÿÿÿ

Oh, in that case the problem you’re having isn’t the one we’ve reproduced. What is your imp serial port connected to? what’s doing the receiving?

Peter

I’ve sent everything to your inbox on the forum.

I’ve been trying to replicate your issue without success. Can you post complete code that replicates it? Try as I may, I can’t get anything out of the serial unless I actually call write().

Whenever I call configure for the UART, I do get a pulse. Are you reconfiguring the UART at every wakeup? That’s a bug, but not generally something you ought to be doing every wakeup.

No I am not reconfiguring the UART every wakeup. I just sent you an email with my code, wiring schematic, and a few more details.

Got it. I’ve queued a release-11 release for your imp ending 04:62, I’d appreciate it if you’d give it a try.