Page 1 of 2

2nd Serial Port Access

Posted: Tue Oct 11, 2016 3:56 am
by a2retro
Taking @ESP_me_no_dev's advice "@a2retro You can attach all 3 UARTs to any pins you like (almost). Pins 9 and 10 are tied to your flash chip, so I would not use them for Serial. You can check esp32-hal-uart.h if you want C style api to the serial or just use HardwareSerial Serial1(1); and then Serial1.begin(baudrate, SERIAL_8N1, rxPin, txPin); to start and use it like any other Arduino Serial"

I seem to be stuck trying to access my serial jpeg camera (Adafruit_VC0706)

So I have confirmed the camera functions correctly when directly connected to a PC and using the provide utility software. I have my FT2232 based programmer sending compiled code down to the esp32 via the default serial port.

I chose to use pin 17 and pin16 as RX and TX respectively.

HardwareSerial Serial1(1);
Adafruit_VC0706 cam = Adafruit_VC0706(&Serial1);
// Try to locate the camera
if (cam.begin((unsigned long) 38400, (uint32_t) SERIAL_8N1, (int8_t) 17, (int8_t) 16)) {
Serial.println("Camera Found:");
} else {
Serial.println("No camera found?");
return;
}

I get no camera found.

I hacked up the default Adafruit sample code to just use HardwareSerial as I got SoftwareSerial compile errors previously.
It's possible i messed something up in my edits of the Adafruit sample code but I am wondering if I am missing anything else at the top level to enable the rx/tx on the second serial port?

Edit: I confirmed by putting my programmers serial port onto pin 17 and 16 that the data is getting through (well at least the printable characters show up in the console) so that's encouraging.

Re: 2nd Serial Port Access

Posted: Tue Oct 11, 2016 7:20 am
by ESP_Me-no-dev
There was a problem with SerialRX because we switched to APP CPU for the loop thread, but I should have it fixed in a commit a few hours ago. Please pull the latest changes and try again :)

Re: 2nd Serial Port Access

Posted: Tue Oct 11, 2016 1:29 pm
by a2retro
@Esp_Me-no-dev - thanks that works great now.

VC0706 Camera test
In Adafruit_VC0706

Camera Found:
-----------------
VC0703 1.00
Ctrl infr exist
OV7720
525
Init end

Re: 2nd Serial Port Access

Posted: Thu Jun 29, 2017 2:16 am
by Guthman
Any way to get support for SotwareSerial.h? / I know there are three UARTS, but 1 is used for SPI flash and can't be used and most boards (Adafruit in this example) use 1 for the USB / Console connection.

I need two more. One for a CAN connection and one for a Cellular breakout. Neither of these are high speed (9600 / 4800 respectively) and shouldn't be a problem processing.

Right now, the compile blows up if you include SoftwareSerial...

Re: 2nd Serial Port Access

Posted: Thu Jun 29, 2017 6:49 am
by WiFive
Guthman wrote: but 1 is used for SPI flash
No you can assign it to other pins using gpio matrix

Re: 2nd Serial Port Access

Posted: Thu Jun 29, 2017 6:50 am
by ESP_Sprite
Where do you get that one is used for SPI flash? That's a SPI peripheral, not an UART.

Re: 2nd Serial Port Access

Posted: Thu Jun 29, 2017 6:56 am
by WiFive
ESP_Sprite wrote:Where do you get that one is used for SPI flash? That's a SPI peripheral, not an UART.
Default (MUX) pins for uart1 are used by flash. This doesn't matter IF you know about gpio matrix.

Re: 2nd Serial Port Access

Posted: Thu Jun 29, 2017 9:20 am
by bbx10node
See if the following works to enable all 3 UARTs. I have used Serial and Serial1 at the same time but have not tried all 3 at once. Post if you get all working at the same time.

Code: Select all

/* ESP32 3 UARTs */

HardwareSerial Serial1(1);
HardwareSerial Serial2(2);
// Choose two free pins
#define SERIAL1_RXPIN 12
#define SERIAL1_TXPIN 13

void setup() {
  Serial.begin(115200);
  Serial1.begin(9600, SERIAL_8N1, SERIAL1_RXPIN, SERIAL1_TXPIN);
  Serial2.begin(4800);  // pin 16=RX, pin 17=TX
}

void loop() {
// Do something wonderful
}

Re: 2nd Serial Port Access

Posted: Thu Jun 14, 2018 3:55 pm
by Nicodemous
a2retro wrote:@Esp_Me-no-dev - thanks that works great now.

VC0706 Camera test
In Adafruit_VC0706

Camera Found:
-----------------
VC0703 1.00
Ctrl infr exist
OV7720
525
Init end
Hey a2retro,

I'm having trouble getting this to work. Are you using the standard Adafruit_VC0706.h library here?

Re: 2nd Serial Port Access

Posted: Thu Jun 14, 2018 7:17 pm
by Nicodemous
ESP_Me-no-dev wrote:There was a problem with SerialRX because we switched to APP CPU for the loop thread, but I should have it fixed in a commit a few hours ago. Please pull the latest changes and try again :)
I'm trying to get the Adafruit_VC0706 working with the ESP32. I'm setting up hardware serial as follows:

HardwareSerial Serial1(1);
Adafruit_VC0706 cam = Adafruit_VC0706(&Serial1);
void setup() {
Serial1.begin(9600, SERIAL_8N1, 27, 15);
if (cam.begin()) {
Serial.println("Camera Found:");
} else {
Serial.println("No camera found?");
return;
}
}

I'm getting no camera found. I'm able to get the camera working on an Arduino Uno with software serial. I scoped the RX and TX lines to see what they should be doing under normal operation. I then hooked the camera back up to the ESP32 and scoped the TX ann RX lines again. The ESP32 sends a signal to the camera, the camera looks to send a signal back to the esp32, (just like it did with the UNO) but then the ESP32 does not respond to the input. Is it possible there was an update to the files since 2016 that brok the rx line again?

Please advise