Bad State on UART2

Hi,

I’m working on serial communication on UART2. I can not subscribe anymore on port:

uart2Handle = adl_fcmSubscribe ( ADL_AT_UART2, iec_UartControlHandler, iec_UartDataHandler);
    if( uart2Handle >= 0 )
        TRACE ((1, "adl_fcmSubscribe() : Subscribed!"));
    else
        TRACE ((1, "adl_fcmSubscribe() : fail! %d", uart2Handle));

neither hardware nor software have changed, today suddenly it stoped working.

trace output:

"adl_fcmSubscribe() : fail! -8"

I think there is a hardware failure on Q268x Development Kit :neutral_face:

any ideas ?

By default UART2 isn’t enabled. Have you done an “AT+WMFM=0,1,2” to switch it on?

hi fft,

yes, first I enable it before using… here is the full code:

adl_atCmdCreate("AT+WMFM=0,0,2", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), iec_AtCmdCreate_Handler, NULL, NULL);
    adl_atCmdCreate("AT+IPR=9600", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), iec_AtCmdCreate_Handler,  NULL, NULL);
    adl_atCmdCreate("AT+ICF=5,1", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), iec_AtCmdCreate_Handler, NULL, NULL);     //at.pdf p: 233,234
    adl_atCmdCreate("AT+IFC=0,0", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), iec_AtCmdCreate_Handler, NULL, NULL);
    adl_atCmdCreate("AT+WMFM=0,1,2", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), iec_AtCmdCreate_Handler, NULL, NULL);

    uart2Handle = adl_fcmSubscribe ( ADL_AT_UART2, iec_UartControlHandler, iec_UartDataHandler);
    if( uart2Handle >= 0 )
        TRACE ((1, "adl_fcmSubscribe() : Subscribed!"));
    else
        TRACE ((1, "adl_fcmSubscribe() : fail! %d", uart2Handle));

    adl_tmrSubscribe ( FALSE, 150, ADL_TMR_TYPE_100MS, StateChecker_TimerHandler );

(that code was working fine until today)

Hi

I’m currently using Q24PL and I use both UARTS. I do this: first I change any parameters (like baud rate, ICF), after this I open it with:

adl_atCmdCreate("AT+WMFM=0,1,2",FALSE,fnBCN13A_UART2Handler,"*",NULL);

after this I subscribe

adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2,fnBCN13A_UART2CtrlHandler,fnBCN13A_UART2DataHandler);

I hope this helps.

Best Regards
Leohen

Hello,

Looking at your code, it seems to me you would like to do a lot of things together which shouldn’t be done together. Please note, when you call an AT command it is not effective immediately, they are just queued up to be processed later by the OS. Why do you close the UART2 and after it you open? You don’t have to close it for setting up the parameters. I think that just can cause trouble.

Anyway i think the nicest solution should look like this:

  1. Check the UART parameters with AT commands like AT+IPR? on UART2 and so on…
  2. If something has to be changed, change it with setup commansd
  3. If something has been changed save it with AT&W command, so you don’t have to issue the setup parameters after a reboot
  4. After you finished with the AT settings, handlers received OK , you can start with adl_fcmSubscribe()…

Cheers,
tom