Society of Robots - Robot Forum
Software => Software => Topic started by: jerome on May 10, 2012, 10:33:22 AM
-
Hello everyone,
I tried to send and receive data trough the usb serial port on axon2 board. I am using last WebbotLib version in c++ and AVRstudio4.
When I sended data from the axon2 to the pc it's works perfectly but when I tried to receive data from the pc, the fourth bits look wrong.
I used the function read() from an instance UartHW. To know what I am receiving, I am sending back the data using a small function to transform each bit in byte
some example :
If I sended 1 from the pc to the board I received 0011 0001
When I send 255 I received : 0011 0010
My code source is here : https://github.com/bechu/hexapod/tree/master/src_win
And the python client here : https://github.com/bechu/hexapod/tree/master/talker
Does one of you ever encounter this problem ?
Thanks in advance,
jerome
-
Don't believe it's a WebbotLib uart problem - as its kinda fundamental to most people. Equally don't have time to wade through all of your code. But I did notice in protocol.cpp you have surrounded a while loop that reads from the uart with CRITICAL_SECTION so your while loop will run with hardware interrupts disabled --- including UART receive/xmit complete interrupts. Looks odd to me!