RS232: 32 bytes per fcm event MAX?


#1

Hi, I’m programming an application for the Fastrack Supreme which has to receive a sequence of characters through the UART1 using the RS232 link. I have had problems when receiving more than one character at a time, being the max number of bytes that I can receive in a packet 32 bytes (or characters).

void adl_main ( adl_InitType_e InitType )
{
 FcmHdl = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART1,FcmCtrlHandler,FcmDataHandler);
}    

bool FcmCtrlHandler (adl_fcmEvent_e Event)
{
    switch (Event)
    {
        case ADL_FCM_EVENT_FLOW_OPENNED:
        {
            adl_atSendResponse ( ADL_AT_UNS, "ADL_FCM_EVENT_FLOW_OPENNED\n\r");
            adl_fcmSwitchV24State(FcmHdl,ADL_FCM_V24_STATE_DATA);
        }
    }

return TRUE;

}


bool FcmDataHandler (u16 DataLen, u8 * Data)
{
    
    char Buffer[150];
    
    sprintf(Buffer," %u : ",DataLen);
    adl_fcmSendData (FcmHdl,(u8*)&Buffer,strlen(Buffer));
    adl_fcmSendData (FcmHdl,Data,strlen((char*)Data));
    
   
return TRUE;
}

I have tested this code in RTE mode an it works OK. It only returns the data and number of bytes received through the RS232. Beyond are the results in target mode with no hardware flow control (it’s a one way communication), 115200bps, 8 data bits, 1 stop bit:

123456789abcdefghijklmnopqrstuvwxyz
35 : 123456789abcdefghijklmnopqrstuvwxyz
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw÷ 3 : xyz
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw 3 : xyz
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw÷ 3 : xyz
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw÷ 3 : xyz N
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw÷ 3 : xyz
123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw÷ 3 : xyz

As you can see there is no answer pattern for the same input. First time I send the test pattern (123456789abcdefghijklmnopqrstuvwx) from the PC to the modem through RS232 it is able to process the whole input (35 characters) however, after this it only process 32 bytes by fcm event, moreover, it adds some ascii control characters (…)
I have read from de Wavecom documentation that max data input from RS232 is limited to 120 bytes, so I don’t understand why I can’t receive more than 32 bytes in one fcm event. Could I been doing something wrong? Why is it receiving such control characters?

Thanks!!


#2

I have made some changes in my code:

bool FcmDataHandler (u16 DataLen, u8 * Data)
{
    
    char Buffer[150];

    sprintf(Buffer," %u : ",DataLen);
    adl_fcmSendData (FcmHdl,(u8*)&Buffer,(u16)strlen(Buffer));
    adl_fcmSendData (FcmHdl,Data,DataLen);
 
return TRUE

Now it seems that I have suppress the control characters (look at the strlen changes) and in spite of generating one event it generates more, but this time I have tried with longer strings and I have seen that it can process more than 32 bytes per event.

123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw 64 : xyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopq 44 : rstuvwxyz123456789abcdefghijklmnopqrstuvwxyz

123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw 64 : xyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopq 44 : rstuvwxyz123456789abcdefghijklmnopqrstuvwxyz

123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz
32 : 123456789abcdefghijklmnopqrstuvw 64 : xyz123456789abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopq 44 : rstuvwxyz123456789abcdefghijklmnopqrstuvwxyz