Author Topic: axon2 and usb serial  (Read 585 times)

0 Members and 1 Guest are viewing this topic.

Offline jeromeTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
axon2 and usb serial
« 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


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,166
  • Helpful? 111
Re: axon2 and usb serial
« Reply #1 on: May 11, 2012, 12:53:33 PM »
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!
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here

data_list