Created Tue, 08 Jan 2013 23:05:14 +0000 by PICedh
Tue, 08 Jan 2013 23:05:14 +0000
Hello,
I try to connect the LS-Y201 LinkSprite’s serial port camera module to the UART2 (pin 39 and 40) of my uno32 but it doesn't work
I use Serial1 as follow:
{ const char RESET_CAMERA[4] = {0x56, 0x00, 0x26, 0x00}; char response[4]; int ret;
Serial1.begin(38400); ret = JPEGCamera (RESET_CAMERA, response, 4); }
int JPEGCamera (const char * command, char * response, int length) {
//Send each character in the command string to the camera through the camera serial port for(int i=0; i<4; i++){ Serial1.print(*command++); }
//Get the response from the camera and add it to the response string. Always 5 bytes for basic commands for(int i=0; i<5; i++) { while(Serial1.available()>0); *response++=Serial1.read(); } }
But the response received is not as expected.
Camera is connected to the shield as follow: camera VCC to shield +5V camera Ground to shield ground camera TX to pin 39 camera RX to pin 40 Is it an issue with Serial1 functions, with the camera or something else ?
thanks for your help
Wed, 09 Jan 2013 02:22:28 +0000
Try Serial1.write to send out your hex data.
All worked fine for me talking to a serial LCD. I was using 9600 baud.
James
Wed, 09 Jan 2013 07:11:37 +0000
I have replace print by write but I have always the same issue, the answer is bad
length:4 command:56-0-26-0> count:10 response:0-FFFFFF9D-FFFFFFA2-FFFFFFAE-8-2E-61-FFFFFF97-35>
How can I check if Serial1 is working ?
Can you put your example of Serial1 ?
Thanks
Wed, 09 Jan 2013 18:31:57 +0000
See: [url]http://github.com/jmlynesjr/chipKIt-Arduino-Examples[/url].
SerialLCDTest.pde. SerialLedTestSER.pde.
Hope this helps. James
Thu, 10 Jan 2013 22:19:38 +0000
Thanks
In fact I had 2 errors, one related tp the detection buffer empty, one related to the type of variable read
1/ I have replaced while(Serial1.available()>0);
by
while(Serial1.available()==0);
2/ I have replaced
*response++=Serial1.read();
by
uint8_t respeonse [5];
response[i] = Serial1.read(); i++;