Rs485 settings

I’m using the FXT009 with the Rs485 expansion card(fw 7.46).
I’m trying to set up a Rs485 connection via FCM and UART2.
I get a connection with FCM and I can send data, but it seems that the data received on the other end isn’t what I’ve send.

The settings in the documentation tells this:
Max. Baud rate: 115200bps
Character framing: 8 data bits
Parity: 1 stop bit and Odd parity
Flow control: no flow control

The settings for the external device should be:
Baud rate 19200
Character framing: 8 data bits
Parity: 1 stop bit and No parity

My question is should I put the settings of my external device in my code? Or the given settings from the documentation?
My code for the setting:

adl_atCmdCreate("AT+WIOM=1,\"GPIO20\",1,1", UART_2,EvhRspUartx,"*",NULL);
adl_atCmdCreate("AT+WIOM=4", UART_2,EvhRspUartx,"*",NULL);
adl_atCmdCreate("AT+ICF=3,4", UART_2,EvhRspUartx,"*",NULL); // 3 =8data 1stop.. 0 = odd 4=none
adl_atCmdCreate("AT+IPR=19200", UART_2,EvhRspUartx,"*",NULL);
adl_atCmdCreate("AT+IFC=0,0",UART_2,EvhRspUartx,"*",NULL);
//adl_atCmdCreate("AT+BRIDGE=19200",UART_2,EvhRspUartx,"*",NULL);
adl_atCmdCreate("AT&W", UART_2,EvhRspUartx,"*",NULL);

Sending ‘0x02’ seems to give ‘63 0’, while dump just says ‘02’

The documentation also tells something about the AT+BRIDGE command, but this gives an error.
Thnx in advance for your help :slight_smile:

Probably I first have to send the AT commands before I switch to the data state, if I send at+ICF? in the console I get +ICF: 7,5, but I think that it isn’t send to the UART2 so…
I’m trying to first get it in at mode now.

void main_task (void)
{
	TRACE (( 1, "Embedded : Main application" ));

	    if(adl_fcmIsAvailable(ADL_FCM_FLOW_V24_UART2)){
	    	TRACE (( 1, "FCM UART2" ));
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO20\",1,1", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=4", UART_2,EvhRspUartx,"*",NULL);

	    	Handle = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2,fcmCtrlH,fcmDataH);
	        //adl_fcmSwitchV24State(Handle,ADL_FCM_V24_STATE_AT);
	        //avail = 1;
	    }
	    else{
	    	TRACE (( 1, "No FCM UART2" ));
	    }
}

Within fcmCtrlH:

case ADL_FCM_EVENT_V24_AT_MODE:
    	adl_atCmdCreate("AT+ICF=2,4", UART_2,EvhRspUartx,"*",NULL); // 3 =8data 1stop.. 0 = odd 4=none
    	adl_atCmdCreate("AT+IPR=19200", UART_2,EvhRspUartx,"*",NULL);
    	adl_atCmdCreate("AT+IFC=0,0",UART_2,EvhRspUartx,"*",NULL);

    	TRACE((1, "UART FCM AT mode"));
       break;

at+bridge command, special baud rates and other extra staff used only with example app. For general rs-485 usage you must configure in your application auto/manual tx/rx switching for half-duplex rs-485. For this, some GPIOs used by board:

GPIO20 - autoswitching (1) / manual switching (0) mode.
GPIO19 - rx/tx switching in manual mode.

Of course you cant use flow control. Except this uart usage as usual. Also you may be interested in GPIO4 … GPIO7 lines for extension board (and board kind) detection.

Ok thnx, so if I understand it well I should do this, to enable board detection and manual mode:

adl_atCmdCreate("AT+WIOM=1,\"GPIO20\",1,1", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO19\",1,1", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO3\",0", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO4\",0", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO5\",0", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=1,\"GPIO6\",0", UART_2,EvhRspUartx,"*",NULL);
	    	adl_atCmdCreate("AT+WIOM=4", UART_2,EvhRspUartx,"*",NULL);

The At commands for the settings stay the same… In the target manager I can see that the UART2 is opened, but it tells it is connected to nothing. And the things I send are still not what I receive.

It works, the TX/RX- and TX/RX+ were in the wrong order, the guy from the other company told it wrong thanks for your help anyway :slight_smile: