Hello everyone
I want to communicate my board to other device via RS485.
I cofigure uart in 9 bits mode to send address and data. Then I check the data in RS485 lines by terminal software and I see that only address bytes (0x00,0x04) are sent and data ('c') are not.
This is my configure code:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0);
GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_1);
GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_0, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
GPIOPinConfigure(GPIO_PB0_U1RX);
GPIOPinConfigure(GPIO_PB1_U1TX);
UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), 9600, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8));
GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_2 );
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_2, 0);
UARTFIFOEnable(UART1_BASE);
UART9BitAddrSet(UART1_BASE,0x00,0x00);
UART9BitEnable(UART1_BASE);
IntEnable(INT_UART1);
UARTIntEnable(UART1_BASE, (UART_INT_RX | UART_INT_RT|UART_INT_FE));
UARTEnable(UART1_BASE);
I use GPIO2 in port B to enable uart1 transmission.
In while(1) command in main.c I send data as follow:
RS485_RTU_TxEnable(); // set GPIO2 in port B
UART9BitAddrSend(UART1_BASE,0x00);
UART9BitAddrSend(UART1_BASE,0x04);
UARTCharPut(UART1_BASE,'c');
RS485_RTU_TxDisable();// reset GPIO2 in port B
Could anyone give me the reason why my code can not send data in RS485 line?
Thank in advance.