Hex bytes over Serial STM32f4 Discovery

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

Moderator: RoccoMarco

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

Hex bytes over Serial STM32f4 Discovery

Post by nikhil »

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: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Hex bytes over Serial STM32f4 Discovery

Post by Giovanni »

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

Post by nikhil »

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: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Hex bytes over Serial STM32f4 Discovery

Post by Giovanni »

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

Giovanni
Post Reply