Initiate serial communication with the library c open () makes TX send one bit to RPi

I am trying to set up serial communication between RPI and FPGA. However, when using the standard C library open () to initialize the serial interface, a problem arises: I use the scope to control what is sent and received through the RX and TX lines. A call to open causes the RPI TX line to become low for one bit length. I do not see this behavior with other computers / Linux-PCs. The fact is that FPGA assumes a valid transfer, since it considers this a start bit, but it is not.

I checked with minicom installed in RPI. Same. Running minicom causes the TX line to send one bit. Once minicom is started, communication works as expected, and all bytes have the correct frame size. Is there a way to suppress a TX line going low to an open call to start a serial connection? Is this expected behavior?

+4
source share
1 answer

This is a super far-fetched guess, but this code seems a little suspicious, from the pl011_startup() function to PL011 the serial port driver :

 /* * Provoke TX FIFO interrupt into asserting. */ 

It seems that it scrolls the TX line when the port starts, which explains the pulse that you see. Of course, an additional investigation will be required before completing this, which is happening, of course.

So, I think my "answer" comes down to: does this sound weird, maybe this is something with the driver?

Of course, one way around this is to take some care at the end of the FPGA, suggesting that you have more control over it. A β€œcorrect” frame will take care of this and make it clear that a false send may be discarded.

UPDATE I meant that if the "correct" messages should always be framed by a certain sequence of bytes, the FPGA can in any case reject invalid ("unpainted") data and thus become immune to a random impulse. For example, messages can be defined to always start with the characters SOH (beginning of the header) or SOT (beginning of the text) ( bytes with values ​​0x01 and 0x02 , respectively).

+1
source

All Articles