Teensy 3.2 Serial1 and Serial3

Status
Not open for further replies.

h4nky84

Member
I've just got back from trying to figure out why the Serial1 is behaving differently to Serial3 with identical code (except of course the reference to Serial1 and Serial3). With Serial3, I can read write bytes exactly as I should be able to. If I change the reference to Serial1 and wire my rs485 transceiver to the Serial1 pins instead, I only can ever read the first byte of a packet.

Is there something I don't know about Serial1 like it has no buffer etc?

Any help would be greatly appreciated as I'm pulling my hair out.
 
Serial1 and Serial2 have FIFOs. All have buffers. Normally the subtle FIFO timing differences are invisible. But if you're doing something (unmentioned in your question) like changing a RS485 transmit enable pin with code that assumes certain timing relationships, perhaps it can matter?
 
Like Paul said, maybe it is timing difference of having the queue. What I would try if I were you would be to see if it worked ok with Serial2. If it does than maybe that is the difference. If not, then maybe the code is using some settings specific for Serial1, like touching some hardware register.

Hard to know without seeing the code.
 
Thanks guys. I'll try using Serial2 and see if the code works.

It is using the transmit enable on a different pin for an RS485 transceiver. It's just odd as exactly the same code works on Serial3 and not on Serial1.

I'll pull the serial code out and post it here. When it's running on Serial3, I can see that the buffer gets an 8 byte frame from another piece of equipment beginning with 0x35. On Serial1 I get feedback that there are 8 bytes waiting in the buffer but when they are read out they start with 0x35 and the rest are zero. Super weird.
 
Status
Not open for further replies.
Back
Top