Community
cancel
Showing results for 
Search instead for 
Did you mean: 
BMist2
Novice
912 Views

UART function Error in D2000

Hi,

I am trying this two functions (line 6 and 7) and both gave different results!

# define MyString ("AT\r\n")

.

.

.

qm_uart_write_buffer(QM_UART_0, (uint8_t *)MyString, sizeof(MyString));

QM_PRINTF("AT\r\n");

qm_uart_write_buffer(QM_UART_0, (uint8_t *)aString, sizeof(aString)); output : AT\r\n0

while QM_PRINTF("AT\r\n"); output : AT\r\n

FYI, I have used QM_UART_LC_8N1 = 0x03, /**< 8 data bits, no parity, 1 stop bit */ for Configuration. And there shouldn't be additional 0 at the end.

Wasted few hours debugging hardware while apparently it was software error!!

0 Kudos
4 Replies
98 Views

Hi ByteMaster,

I tried to reproduce back your issue but it seem like there no issue on my machine. Could you try to repair/reinstall back the ISSM 2016 to see if the issue still persist. If yes, please help to provide more details on the setup to reproduce back the issue.

Thanks.

Soffi

BMist2
Novice
98 Views

Hi Soffi,

Try with Logic analyzer or oscilloscope..it appears in there.

Thanks

Michelle_C_Intel
Employee
98 Views

Hi ,

It seems you are also seeing the null character that marks the end of the string -- Do you see the same issue is you use strlen rather than sizeof to calculate the length ?

It seems ok for me ..

# include

# include

# include

# define MyString ("AT\r\n")

int main(void)

{

qm_uart_write_buffer(QM_UART_0, (uint8_t *)MyString, strlen(MyString));

QM_PRINTF("AT\r\n");

return 0;

}

regards,

Michelle.

BMist2
Novice
98 Views

Hi Michelle,

This make sense.

it works with strlen instead of sizeof

Please check the output of this three lines in attached pic.

qm_uart_write_buffer(QM_UART_0, (uint8_t *)MyString, sizeof(MyString)); /* Send "AT\r\n" */

qm_uart_write_buffer(QM_UART_0, (uint8_t *)MyString, strlen(MyString)); /* Send "AT\r\n" */

QM_PRINTF("AT\r\n"); /* Print "AT\r\n" */

Reply