UART receive problem
Posted: Fri Nov 17, 2017 1:06 pm
Hello all
I am having a problem with a serial receive that I hope you could help me with.
I send a number to an instrument and receive data from it using channel 2 UART on a 18F46K22 using 9600 baud. One character is sent and one is received. Most often the return character is incorrect with a value of 255 or sometimes another incorrect value. The time taken for the instrument to respond it 13mS and I have set the receive timeout to 25mS. I have measured on the chip, using a logic analyser, that the timing and framing are correct and that the received byte is always the correct value. This runs within a timer interrupt and so I guess there is nothing being called to do between sending and receiving.
I changed to this scheme after first using a receive interrupt scheme and that too delivered similar unreliable UART reads.
Channel 1 UART does a similar bidirectional communication without a problem.
Thanks
Howard
I am having a problem with a serial receive that I hope you could help me with.
I send a number to an instrument and receive data from it using channel 2 UART on a 18F46K22 using 9600 baud. One character is sent and one is received. Most often the return character is incorrect with a value of 255 or sometimes another incorrect value. The time taken for the instrument to respond it 13mS and I have set the receive timeout to 25mS. I have measured on the chip, using a logic analyser, that the timing and framing are correct and that the received byte is always the correct value. This runs within a timer interrupt and so I guess there is nothing being called to do between sending and receiving.
I changed to this scheme after first using a receive interrupt scheme and that too delivered similar unreliable UART reads.
Channel 1 UART does a similar bidirectional communication without a problem.
Thanks
Howard