Hex bytes over Serial STM32f4 Discovery

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Hex bytes over Serial STM32f4 Discovery

Postby nikhil » Sat Jan 12, 2013 2:35 am

Hello,

I want to send and receive hex bytes over Serial. I guess chIOPut sends uint8_t. Can anyone help me with this? Is there any way other than chIOPut and chIOGet to send and receive data in hex bytes?
I am using STM32F4 discovery board with ChibiOS 2.4.3

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Hex bytes over Serial STM32f4 Discovery

Postby Giovanni » Sat Jan 12, 2013 7:52 am

I assume that for "hex bytes" you mean sending bytes as two ASCII characters, you can use chprintf() for that. Remember it is just ASCII data, handle it as such.

Giovanni

nikhil
Posts: 40
Joined: Thu Jan 03, 2013 8:46 pm

Re: Hex bytes over Serial STM32f4 Discovery

Postby nikhil » Sat Jan 12, 2013 12:46 pm

I dont want to deal with data in ascii. I want to send and receive data as single hex byte. for example I want to send only 0xC1 and receive 0xC1 as a hex byte.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Hex bytes over Serial STM32f4 Discovery

Postby Giovanni » Sat Jan 12, 2013 1:50 pm

Bytes are bytes, there are not decimal bytes or hexadecimal bytes. Any function exchanging uin8_t data exchanges bytes.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 15 guests