Hi Kerry.
Without the RS485, Modbus works fine, without problem. The problem appears when I clear the pin after finishing the transmition.
Here is the interruption code for the transmition:
void Slave_TxChar_ISRF(void) {
if(contadorTX != 0) { //¿Is there data to transmit?
*bufferTX_ptr++ = 0;
contadorTX--;
FLEXIO_UART_WriteByte(&uartDev, bufferTX_ptr); //Sends next byte
}
else if (contadorTX == 0) { //¿Was all the data transmited?
*bufferTX_ptr++ = 0;
bufferTX_ptr = &bufferTX[0];
FLEXIO_UART_DisableInterrupts(&uartDev, kFLEXIO_UART_TxDataRegEmptyInterruptEnable);
GPIO_PortClear(FLEXIO_Control_RS485_GPIO, 1<<FLEXIO_Control_RS485_PIN); //Clear RS485 Control Pin
}
}
Here are the correct transmitted frame and the wrong transmitted frame:
01 03 02 00 00 B8 44 --> Correct
01 03 02 00 00 B8 FE --> Incorrect
The kinetis part number is : MKE14F512VLH16.
Good day,
Diego.