go away spammer

Author Topic: FIXED!!! Blackfin Camera Communication issues  (Read 4634 times)

0 Members and 1 Guest are viewing this topic.

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
FIXED!!! Blackfin Camera Communication issues
« on: August 10, 2009, 12:27:05 AM »
I couldn't decide whether this was a software or hardware issue.  It could go either way so I just picked a forum.

I've had a blackfin for a while now and I would like to finally interface it with a robot, but each time I pick the thing up.  I get so frustrated I put it aside.  My problem at the moment is that my microcontroller does not receive the data correctly from theblackfin its garbled like a baud mismatch.

setup same as the blackfin axon tutorial rx's to tx's and flow control overridden on the blackfin.

Here's what I know for sure  

1. I can communicate with the blackfin with my computer via bluesmirf or ftdi cable
2. The blackfin recognizes the commands I send from my avr (proved this with a second ftdi cable to my computer)
3 the baud is definitely correct 115200 for both devices.  I would not have gotten data to my PC otherwise, and likewise would not have been able to send data to the blackfin

what I've tried

1. I guessed that the 3.3V logic from the blackfin may not be reliably recieved as a high signal by the avr.  So I tried a pull up resistor first in hardware, then in software neither worked.

what else I think may be wrong

1.  I am wondering if the error at 115200 baud (16MHz crystal) may be coming into play if I have wires ~12" long


my software is attached the files of interest are the uartn (n = number), print, and main.  
« Last Edit: August 13, 2009, 02:20:39 PM by sonictj »

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #1 on: August 10, 2009, 01:30:52 AM »
I just got an email back from the Surveyor guys and they recommend a level shifter, which makes sense, but Admin doesn't have to use a level shifter with his setup  ???.  No harm in trying one out I guess. 


Any thoughts?

Offline flimflap

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Re: Blackfin Camera Communication issues
« Reply #2 on: August 10, 2009, 01:47:42 AM »
We never had any problems with a 7.37 etc crystal. Maybe try a lower baudrate and see if it helps.

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #3 on: August 10, 2009, 08:01:25 AM »
I was talking about my avr with the 16 mHz crystal

Offline hgordon

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 373
  • Helpful? 7
    • Surveyor Robotics Journal
Re: Blackfin Camera Communication issues
« Reply #4 on: August 10, 2009, 05:21:28 PM »
What exactly is the 115200 baud rate with a 16MHz crystal ?   I think in the past we've had trouble interfacing wwith XBee modules at 115200 because they actually run closer to 112400.
« Last Edit: August 29, 2009, 05:31:49 PM by hgordon »
Surveyor Corporation
  www.surveyor.com

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #5 on: August 10, 2009, 05:49:38 PM »
http://surveyor-corporation.stores.yahoo.net/srblcabo.html  its says here that the default baud is 115K for uart0.  Plus the camera communicates fine at that baud rate to my computer.

Quote
What exactly is the 115200 baud rate with a 16MHz crystal ?


My AVR board is running at 16Mhz with its uart at 115200 baud.  At 16Mhz the baud is off I think by 3%.  you have to use a 14. something MHz crystal for there to be no error. 

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Blackfin Camera Communication issues
« Reply #6 on: August 10, 2009, 07:41:38 PM »
Quote
I can communicate with the blackfin with my computer via bluesmirf
Wait, you got it to work with a bluesmirf?! At least with the older bluesmirf version, I was never able to get it to work. Well, except once, but never figured out why, nor could I repeat it . . . I also never got it to work with a CP2102 . . . but it works fine with ftdi!

Quote
1. I can communicate with the blackfin with my computer via bluesmirf or ftdi cable
2. The blackfin recognizes the commands I send from my avr (proved this with a second ftdi cable to my computer)
wait . . . so both work, then whats wrong? ???

This is my setup, exactly:
http://www.societyofrobots.com/electronics_blackfin_camera.shtml
(yea, its a rough draft, and I plan to finish it one day!)

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #7 on: August 10, 2009, 09:53:51 PM »
The problem is on the recieving end of the avr.

Quote
I also never got it to work with a CP2102

I've used mine and it worked

Quote
This is my setup, exactly:
http://www.societyofrobots.com/electronics_blackfin_camera.shtml
(yea, its a rough draft, and I plan to finish it one day!)

I'm connected in the same fashion.  I checked your uart initializations too and we are using the same settings, with the exception I don't use , or have set the tx complete interrupt.  I guess I could try the axon code and see if I get any different results.  The only possibility I can think of now is software since the axon works with the blackfin and I have nearly identical hardware.


**EDIT when I power the blackfin I use a 12V battery hooked up to the green board for power. The regulator seems to want more than 5V.  For a switcher that seems like a pretty high dropout voltage.  6V should work, but I haven't tried it.
« Last Edit: August 10, 2009, 10:29:07 PM by sonictj »

Offline flimflap

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 1
Re: Blackfin Camera Communication issues
« Reply #8 on: August 11, 2009, 04:28:06 AM »
I only ordered a single blackfin camera so i dont know anything about the boards you get with tha packige but i asssume they are way better than the ones i made.
Only thing i can suggest is to lower the baudrate of both the camera and the avr.
Just checking, but do the 2 boards share ground?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: Blackfin Camera Communication issues
« Reply #9 on: August 11, 2009, 05:11:44 AM »
yes, they share gnd.
T is for transmit, R is for receive, G is for ground. they're the three wires you need
Howdy

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Blackfin Camera Communication issues
« Reply #10 on: August 11, 2009, 05:31:22 AM »
Can it be a stupid fuse bit setting? Like clockdivby8 or something like that? I remember a post that may be related to your problem: http://www.societyofrobots.com/robotforum/index.php?topic=2679.msg47933#msg47933

Good luck!
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Blackfin Camera Communication issues
« Reply #11 on: August 11, 2009, 07:35:32 AM »
just a stupid-check . . . got interrupts running?

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #12 on: August 11, 2009, 08:13:03 AM »
Quote
do the 2 boards share ground?

yep

Quote
just a stupid-check . . . got interrupts running?

just the ones for the uart.  I tried another test last night I made a txt file and then sent that to the board.  I made sure the file was longer than the version string sent out by the blackfin.  My AVR board recieved and spit out the file correctly.  I figure thats the same amount of stress on the uart. Do you agree ?

« Last Edit: August 11, 2009, 08:14:19 AM by sonictj »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Blackfin Camera Communication issues
« Reply #13 on: August 11, 2009, 11:41:26 AM »
As you suggested earlier, I'd recommend using my Blackfin code for the Axon. That'll verify whether its a hardware or software issue.

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #14 on: August 11, 2009, 12:32:08 PM »
As you suggested earlier, I'd recommend using my Blackfin code for the Axon. That'll verify whether its a hardware or software issue.

Thats probably the next step I'll try that in a bit

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #15 on: August 11, 2009, 02:16:28 PM »
I just uploaded the axon source and I'm having issues.

I simply took the axon source with no alterations, and nothing comes up in hyper terminal.  yet during the initializations of the axon in axon.c there is a an rprintf statement sent to uart1 stating something like the initializations finished.  I'm confused.
« Last Edit: August 11, 2009, 10:02:47 PM by sonictj »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Blackfin Camera Communication issues
« Reply #16 on: August 12, 2009, 06:47:48 AM »
Sounds like you aren't accounting for the right UART ports. My Blackfin code changes the UART port behind your back - its a 'feature' I added so people didn't have to change it themselves.

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: Blackfin Camera Communication issues
« Reply #17 on: August 12, 2009, 11:22:56 AM »
I know the blackfin is uart3 I'm talking about uart 1.  I just simply compiled/uploaded the axon code and uart1 never printed anything even though there was an rprintf statement in the initializations.  It would be easy for me to figure out whats going on except when I run the simulator, assembly code pops up.  I don't know how to switch to simulating the c code, and I'd rather not read through the full instruction set of the AVRs  :P.
« Last Edit: August 12, 2009, 11:25:10 AM by sonictj »

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: FIXED!!! Blackfin Camera Communication issues
« Reply #18 on: August 13, 2009, 02:25:17 PM »
I just fixed the problem the reason I suspect was timing of the ATmega640 uart and the Blackfin's uart.  I was using 115.2k buad but without the U2Xn bit set (double speed).  The baud calculation was corect , but the error was high enough to cause bad communication.

@ Admin you did not encounter this problem because of your camera's default baud being 38400.  Since you bought the product the firmware has changed a few times.  You may want to include this information in your tutorial when you get around to it.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: FIXED!!! Blackfin Camera Communication issues
« Reply #19 on: August 13, 2009, 02:38:04 PM »
Well, as hgordon mentioned to me a month or two ago, the firmware has changed a lot in the last year. So some of my software is probably no longer compatible. I'll have to upgrade it all before posting the tutorial. My ERP code all works on the old firmware versions . . .

Offline sonictjTopic starter

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
    • Tim's Workshop
Re: FIXED!!! Blackfin Camera Communication issues
« Reply #20 on: August 13, 2009, 02:44:26 PM »
Well, as hgordon mentioned to me a month or two ago, the firmware has changed a lot in the last year. So some of my software is probably no longer compatible. I'll have to upgrade it all before posting the tutorial. My ERP code all works on the old firmware versions . . .

I was just talking about the timing issues associated with the uart.  Its not your fault if the blackfin changes firmware ect.  people can make their own functions.  Its just a bit hard to do anything if you cannot get any data from the Blackfin  :P.

 


Get Your Ad Here

data_list