go_away

Author Topic: help me write AVRcam library... having issues  (Read 5210 times)

0 Members and 1 Guest are viewing this topic.

Offline frank26080115Topic starter

  • Supreme Robot
  • *****
  • Posts: 322
  • Helpful? 2
help me write AVRcam library... having issues
« on: December 20, 2007, 12:34:01 AM »
I know you guys want your AVRcams to work, I'm working on a library to make it simple.

Damn thing, I have my code soooo perfect, and yet it still won't work, the problem is that after I send the configuration, the camera responds with ACK\r, right? It does respond with a ACK\r, however, my code doesn't recognize the A, it instead sees a character with a decimal value of 168, then 170, then 78...

WTF

I want to smash my head against a wall here... this is pretty much out of my troubleshooting skills

hardware is perfect, both sides are outputting the right characters, the camera is acknowledging, by my mcu isn't taking in the right bytes, how ever I can bootload it without a problem, so my chip is not the issue

my buffer isn't read at all until the first "A" so I can't be throwing it away

my timeout has already been set to an entire second worth of waiting, how slow can it get??

Talk to me on AIM (frank26080115) or MSN ([email protected])... I need people to look at my code before I release it...

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: help me write AVRcam library... having issues
« Reply #1 on: December 20, 2007, 10:47:59 AM »
Are both devices comunicate at the same baud rate? It should be 115.2kbps...
What is the error for the Arduino at that particular baud?
I am still working fast on my hardware so I can start on the code. But so far I have tryed to compile in Arduino the code that you posted for the AVRcam but I got some error that the waitACK() is out of scope. I am a noob in Arduino (and programming) and didn't had time to troubleshoot it (I guess is something simple...).
However, I liked the simplicity of the code, and I think it should work.
Try sending PG/r and see if the cam responds with ACK/r like it should in Hyperterminal. If it does, then it is a matter of communication between the cam and Arduino.
Check out the uBotino robot controller!

Offline frank26080115Topic starter

  • Supreme Robot
  • *****
  • Posts: 322
  • Helpful? 2
Re: help me write AVRcam library... having issues
« Reply #2 on: December 28, 2007, 12:58:14 PM »
it's documentation is horrible, it's not \r at the end of a command, if doesn't get \n\r, it won't respond... this could be where my troubles lie, but changing this does not fix the problem

The chip runs at 16MHz, error at 115200 baud is 3.5%, it has never given me sync trouble before,

the camera works fine with the computer software

it might be because the ACK message is sent so fast that my serial buffer handling interrupt isn't working fast enough, but even at 115200 baud, i should be doing 8 to 16 million instructions per second while only receiving 11520 bytes per second...

have a go with it, here's the library file, instructions are inside
« Last Edit: December 28, 2007, 02:22:14 PM by frank26080115 »

Offline mbateman

  • Full Member
  • ***
  • Posts: 82
  • Helpful? 0
    • Robotics 4 Fun
Re: help me write AVRcam library... having issues
« Reply #3 on: January 03, 2009, 08:51:15 AM »
I had this same issue with the AVRcam. I was able to solve it by using the double-clock method of setting the UART speed. Using this method, the error rate is only 2.1% which seems to be enough to let it work. With the -3.5% of the normal setting, it lost the 9th bit which is enough to make it miss the start bit of the next character and return what looks like junk.

Here are the settings:
UCSR2C=0x06;    // UART2 = 8,1,n
UCSR2A=0x12;    // 15,200 using double clock speed
UBRR2L=16;        // 15,200 using double clock speed

Also, I have an AVRcam module for the Axon. See this post...
http://www.societyofrobots.com/robotforum/index.php?topic=6352.0

 


Get Your Ad Here