Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9873 Discussions

UART function Error in D2000

BMist2
Novice
1,072 Views

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
MuhamadSof_B_Intel
259 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
259 Views

Hi Soffi,

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

Thanks

Michelle_C_Intel
Employee
258 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
259 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