RS485 9 Bit Comms on LPC2148
2005-12-12 by mhoneywill
Hi, I'm implementing a comms protocol which requires RS485 half duplex comms with a 9 bit data word for the first byte. I'm new to the LPC214x chips so was wondering if anyone could give me some pointers. My thoughts are described below. Half Duplex Comms It looks like UART0 and UART1 have both FIFO empty and ShiftRegister empty Flags, IF you enable the THRE interupt enable bit in UxIER, you will recieve an interupt if the FIFO is empty, but the shiftRegister could still contain data being transmitted. You have to wait for the TEMT bit in UxLSR to be set. It looks like you have to poll this bit, it is not associated with an interupt, is this right? What is the point of having this bit if it doesn't cause an interupt? 9 Bit Comms TX This is a bit more tricky and to transmit a character with the 9th bit set I guess you need to do the following. 1. Set Parity bit to "Forced 1 stick parity" 2. Enable Parity 3. Transmit first character 4. Wait for first character to be transmitted by monitoring the TEMT bit (Same problem as above as you need to poll this bit) 5. Disable Parity 6. Transmit the rest of the message. 9 Bit Comms RX This is even more of a bodge, I'm guessing you could disable parity then use the PE (Parity error) bit to wake up a reciever to the fact that it is recieving the first byte of a message, with the 9th bit (parity bit) set. Reading the data sheet it looks like the the recieved data is still in the FIFO. You would just use this PE to indicate the start of a message. Does the above tie in with other peoples experience of using these LPC chips in this mode. Philips do seem to make it overly complex to implement these sort of comms protocols, which embedded systems do seem to use. All ideas and comments greatfully recieved. Martin [Non-text portions of this message have been removed]