FullDuplexSerial and Serial Component
pattywac
Posts: 22
Hello Everybody,
I am pretty new to the prop and could use some help. I am trying to use the FullDuplexSerial code to send a specific hex value ($56002600) to the component (linksprite jpeg camera) and should be receiving a specific message back from the camera ($76 00 26 00).
I am fairly confident that I have everything wired up correctly, but less sure of my code. I seem to be receiving bytes back, but they are all ($FF) or at least the way I'm reading the rx they are all ($FF).
I've included my code below and here is the repeating response that I get via the terminal window :
Hex test FFFFFFFF
If I'm doing anything blatantly wrong, please point it out.... otherwise, any ideas why I might not be getting the right signal back?
Thanks!
I am pretty new to the prop and could use some help. I am trying to use the FullDuplexSerial code to send a specific hex value ($56002600) to the component (linksprite jpeg camera) and should be receiving a specific message back from the camera ($76 00 26 00).
I am fairly confident that I have everything wired up correctly, but less sure of my code. I seem to be receiving bytes back, but they are all ($FF) or at least the way I'm reading the rx they are all ($FF).
I've included my code below and here is the repeating response that I get via the terminal window :
Hex test FFFFFFFF
If I'm doing anything blatantly wrong, please point it out.... otherwise, any ideas why I might not be getting the right signal back?
Thanks!
Con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ term : "FullDuplexSerial.spin" serialTerminal : "Parallax Serial Terminal.spin" Pub Main | capturedValue serialTerminal.Start(38_400) term.start(0, 2, 0, 38_400) term.hex($56002600, 8) capturedValue := term.rxtime(100) capturedValue := (capturedValue << 8 ) + term.rx capturedValue := (capturedValue << 8 ) + term.rx capturedValue := (capturedValue << 8 ) + term.rx term.stop repeat waitcnt(50_000_000 + cnt) serialTerminal.Str(string("Hex test ")) serialTerminal.Hex(capturedValue,8) serialTerminal.NewLine while (1)
Comments
Neither of those options seemed to work, which led me to believe that my wiring was incorrect. I checked it over 10-15 times and it seemed perfect, so I broke my multimeter and started testing voltages. For some strange reason my powersupply was only putting out approximately 3.6volts. In various forums I read that this specific camera doesn't like anything below 5v. I fixed the PS issue and went back to the code.... still didn't work. I cleaned it up a bunch and tried to test the 'tx' code even more and found a combination that works:
It seems strange that your code didn't work because from what I can tell, it should be doing the same thing as the four consecutive 'tx' calls. For now I'm happy, I got back the right hex code in response from the camera module (76002600).
Now that I look at it, shouldn't your second option (starting with $56) be:
Edit: I just did some quick checks and this doesn't really add up. The loop version takes 22320 cycles to get the 4 bytes into the serial object. At this speed (38400) this is still (nearly) covered by the time it takes to send the first character (20833 cycles). So it's unlikely to be between-character-delays. But people here have brought up really weird timing issues before so who knows.
Out of curiosity, what's the response you get from the camera when you use the loop version (rotate-before-send)? It may be useful to print each byte as you receive it.
Here's the data sheet:
http://www.sparkfun.com/datasheets/Sensors/Imaging/1274419957.pdf