Switching baudrate on UART1 while subscribed to a flow


#1

Hi all,

I have the following problem.

• Firmware version 6.57
• OpenAT OS 3.17
• Q2406B / new Q24 series

I wrote an application that communicates with 2 different clients on UART1 in data mode via RS232 connection where only Rx and Tx are connected. The clients are switched by a MUX but have different baudrates. The flow subscribed to UART1 is the only one in this application.
In the ADL User Guide is written:

"• For serial link flows, the serial line parameters (speed, character framing,
  etc...) must not be modified while the flow is in data state. In order to change
  these parameters' value, the flow concerned has firstly to be switched back in
  AT mode with the adl_fcmSwitchV24State API. Once the parameters have
  changed, the flow may be switched again to data mode, using the same API."

That’s what the software is doing successfully since OpenAT version 3.12 in more than 300 products that are delivered to customers in different units.
The steps that are performed to modify the baudrate are explained below.

1. adl_fcmReleaseCredits(main_uart.handler, 0xFF);
2. adl_fcmSwitchV24State(main_uart.handler, ADL_FCM_V24_STATE_AT);
3. Wait a maximum of 5 seconds for the ADL_FCM_EVENT_V24_AT_MODE event. Else go back to step 1.
4. adl_atCmdCreate("AT+IPR=4800", ADL_AT_PORT_TYPE(ADL_AT_UART1, FALSE), result_set_baudrate_Handler, "*", NULL);
5. Wait a maximum of 5 seconds until the event handler receives the “OK”. Else go back to step 4.
6. adl_fcmReleaseCredits(main_uart.handler, 0xFF);
7. adl_fcmSwitchV24State(main_uart.handler, ADL_FCM_V24_STATE_DATA);
8. Wait a maximum of 5 seconds for the ADL_FCM_EVENT_V24_DATA_MODE event. Else go back to step 6. 

But now there are 2 units that won’t change the baudrate because the application doesn’t receive the ADL_FCM_EVENT_V24_AT_MODE event.
The both units are assembled on buoys on sea. Therefore I don’t have any possibilities to put an oscilloscope on the serial lines to see if there is any action while the module tries to switch from AT to data mode (it’s only one possibility that I could imagine). I tried to trigger this malfunction here in my office without success so far. As a workaround I uploaded a new application via DOTA on the both stations. The application is now switching the baudrates while the flow is in data mode with

adl_atCmdCreate(“AT+IPR=4800”, ADL_AT_PORT_TYPE(ADL_AT_UART1, FALSE), result_set_baudrate_Handler, “*”, NULL);

It’s working but it causes an unpleasant feeling in me (“ … must not be modified while … in data state …”).

Any help would be appreciated.


#2

I’m struggling with baud rate changing, but my problem is (apparently) that app does not receive ADL_FCM_EVENT_V24_DATA_MODE event after buad rate change (issued by at+ipr command).
If I only run a simple app, that only change baud rate (looping from 9600 to 600) and send few bytes through uart1, it works. If the amount of bytes sent/read increases, after a few baud rate changes, the module apparently stays in AT mode. I figured it out that module is on AT mode by sendind AT commands (and getting responses) using an external applications.
I’ve put a timer handler to re-issue a adl_fcmSwitchV24State(DATA_MODE) if the ADL_FCM_EVENT_V24_DATA_MODE event is not received.

Is there a way to check within app which MODE is active?

Info: Open AT OS 3.14.03, Q24E

Thanks in advance.