Page 1 of 1

Hex bytes over Serial STM32f4 Discovery

Posted: Sat Jan 12, 2013 2:35 am
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

Re: Hex bytes over Serial STM32f4 Discovery

Posted: Sat Jan 12, 2013 7:52 am
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

Re: Hex bytes over Serial STM32f4 Discovery

Posted: Sat Jan 12, 2013 12:46 pm
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.

Re: Hex bytes over Serial STM32f4 Discovery

Posted: Sat Jan 12, 2013 1:50 pm
by Giovanni
Bytes are bytes, there are not decimal bytes or hexadecimal bytes. Any function exchanging uin8_t data exchanges bytes.

Giovanni