Forums - 4 Byte UART communication

5 posts / 0 new
Last post
4 Byte UART communication
nasrul.shaari
Join Date: 9 Jun 17
Posts: 5
Posted: Fri, 2017-06-09 03:54

Dear Sir

I am new in develop the firmware that related wit CSR1010 Chipset.

Currently I try to develope firmware related with the CSR1010 IC.

I need to know the methods and procedure for sending and receiving the 4 byte data through UART Port. The Byte data is in Hex code.

I already check the CSR uart example and it is mostly related with the ASCII code. 

Can anyone help me regarding this matter

  • Up0
  • Down0
Dr. Nissim Zur
Profile picture
Join Date: 6 Jun 16
Location: Skype: nissim.test CSR1010 External design house
Posts: 235
Posted: Sat, 2017-06-10 00:27

UART send just bytes.  it sends one byte at the time. (8Bit)

HEX and ASCII are a human presentative of the value of that byte. 

HEX is in a form 0xXY and Ascii as a character. 

So, your assumption that the UART example sends "ASCII" is wrong. It sends bytes. 

When you receive that bytes, fill a buffer with them and you will have 4 bytes. Buffer array of bytes or characters is 100% same. 

You can call my Skype nissim.test

  • Up0
  • Down0
nasrul.shaari
Join Date: 9 Jun 17
Posts: 5
Posted: Sun, 2017-06-11 23:27

Hi Nissim Zur

1 message UART contain 4 bytes of data. I want to use the MILLISECOND ((TIME)(1000)) for create 2ms interval between 2 message.

I already add the time.h inside header folder.

Below is the firmware I wire.

*/

/* Display the first message */

const uint8 message[] = {0x02,0x42,0x00,0x23};

const uint8 message_len = (sizeof(message))/sizeof(uint8);

 

/* Add the first message to byte queue */

BQForceQueueBytes(message, message_len);

 

/*Delay 1ms*/

MILLISECOND ((2)(1000));

 

/*Display the second message*/

const uint8 message1[] = {0x02,0x42,0x00,0x23};

const uint8 message1_len = (sizeof(message1))/sizeof(uint8);

 

/* Add second message to byte queue */

BQForceQueueBytes(message1, message1_len);

 

Can you help me how I can make 2ms interval message?

Base on the Firmware above the error code show as below.

uartio.c: In function 'Start':

uartio.c:261: error: called object '2' is not a function

uartio.c:261: error: called object '1000ul' is not a function

 

  • Up0
  • Down0
nasrul.shaari
Join Date: 9 Jun 17
Posts: 5
Posted: Mon, 2017-06-12 18:46

Dear Sir

I already manage to sent 4 byte Uart communication from CSR1010 to another MCU.

1 message contain 4 byte data. Can I use MILLISECOND((TIME)(1000)) to create interval between 2 message data? If can how do I need to put this to my firmware.

 

  • Up0
  • Down0
Dr. Nissim Zur
Profile picture
Join Date: 6 Jun 16
Location: Skype: nissim.test CSR1010 External design house
Posts: 235
Posted: Mon, 2017-06-12 21:00

In real time system,  as in CSR1010, it is not allowed to make a close loop with delay. 

Therfor I offer you to create a timer interrupt and send the 4 bytes in that interrupt service routine. 

You can call my Skype nissim.test

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.