RS485 Half Duplex
Posted: Mon Jul 27, 2020 2:08 pm
I am using a Mod5234 , Uart 1 and using it for a Modbus RS485 ( Half Duplex ) communications.
The Uart_RX , Uart_Tx and Uart_RTS are controlling a SN65HVD1780 chip. I can see the data is been TX but the RX data is low. This is because the RTS Line just remains high.
How do I control the RTS line. The command SerialEnableHwTxFlow(MB_MASTER_PORT,1); just seem to disable the coms
I am using interrupt based comms ...
ComsStatus = WAITING; // Clear the coms state
MessageCounter = 0 ; // Initialize the message counter
pReceiveTimer = &pCounters->MB_ReceiveTimer; // Get the reference to the receive timer
pMBService= new Modbus(); // Create the Modbus Service class
pRxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the RX buffer
pTxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the TX buffer
// Open the port
SerialClose(MB_MASTER_PORT);
SerialEnableHwTxFlow(MB_MASTER_PORT,1);
OpenSerial(MB_MASTER_PORT, MB_BAUD,1,8,eParityNone);
UartData[MB_MASTER_PORT].m_pPutCharFunc = MasterReceiveCallback; // Set the receiver callback
UartData[MB_MASTER_PORT].m_pGetCharFunc = MasterTransmitCallback; // Set the transmiter callback
iBytesReceived = 0 ;
The Uart_RX , Uart_Tx and Uart_RTS are controlling a SN65HVD1780 chip. I can see the data is been TX but the RX data is low. This is because the RTS Line just remains high.
How do I control the RTS line. The command SerialEnableHwTxFlow(MB_MASTER_PORT,1); just seem to disable the coms
I am using interrupt based comms ...
ComsStatus = WAITING; // Clear the coms state
MessageCounter = 0 ; // Initialize the message counter
pReceiveTimer = &pCounters->MB_ReceiveTimer; // Get the reference to the receive timer
pMBService= new Modbus(); // Create the Modbus Service class
pRxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the RX buffer
pTxBuffer = (BYTE *) malloc(MB_BUF_SIZE); // Allocate the TX buffer
// Open the port
SerialClose(MB_MASTER_PORT);
SerialEnableHwTxFlow(MB_MASTER_PORT,1);
OpenSerial(MB_MASTER_PORT, MB_BAUD,1,8,eParityNone);
UartData[MB_MASTER_PORT].m_pPutCharFunc = MasterReceiveCallback; // Set the receiver callback
UartData[MB_MASTER_PORT].m_pGetCharFunc = MasterTransmitCallback; // Set the transmiter callback
iBytesReceived = 0 ;