Send Null Characters through UART

Hi,

I need to send a bunch of Null character to the external device through UART2. I tried using adl_fcmsend function but it failed.

Kindly provide help on the same.

That’s like saying, “My car’s not working - what’s wrong with it?”

What, exactly, did you try?

How, exactly, did it fail?

Hi,

I tried to send the following characters ‘0x55’, ‘0xAA’, ‘0x02’, ‘0x01’, ‘0x00’, ‘0x00’, ‘0x02’ and ‘0x01’ using the following code snippet.

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x55,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0xAA,1);

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x02,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x01,1);

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x00,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x00,1);

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x02,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x01,1);

I checked the return value of adl_fcmSendData, when writing adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x00,1); it is returning error code as -2 (one of the parameter has incorrect value).

So look at the parameter values that you’ve supplied, and ask yourself which one(s) are wrong…

Hint: It’s a basic ‘C’ mistake - nothing specifically to do with Open-AT…

:question:

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x55,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0xAA,1);

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x02,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x01,1);

adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x00,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x00,1);


adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x02,1);
adl_fcmSendData(Gps_Fcm_Handle,(u8*)0x01,1);

:question:

try something like this:

u8 msg[8];
msg[0] = 0x55;
msg[1] = 0xAA;
..
..
adl_fcmSendData(Gps_Fcm_Handle,(u8*)msg,8);

the code can contain errors, only for conceptual understanding.

Hi,

I need to send the following hex values (0x55,0xAA,0x02,0x01,0x00,0x00,0x02,0x01) through UART2. How to send these characters. Kindly help me.

Thanks I got it working.

You saw the mistake in your original code, then?

You understand now that you mustn’t just go casting an arbitrary byte value to a pointer?

In particular, you mustn’t just go casting any zero value to a pointer! :open_mouth:

Again, this is standard ‘C’ stuff - nothing specifically to do with Open-AT.

You may post your solution to help others.