Can I use all 3 UART Ports of AMB82-Mini Board while using camera Module for recording MP4 file in SD Card

I’m using an AMB82-MINI Board with the Arduino SDK. I’m working on a project where I need to utilize all three UART ports of the AMB82, as well as the I2C port, while also using a camera module.

Can I achieve this? Specifically, can I use all three UART ports simultaneously while the camera module is recording MP4 video to an SD card? Is any of the AMB82 MINI’s UART ports internally interfaced or occupied when the camera module is in use?

@Kelvin_Huang

Yes you can

Hi @Pradumn_Porwal,

May I know what issue are you facing? I am able to use other serial port and record at the same time.

Please refer to the attached code for reference.

/*

 Example guide:
 https://www.amebaiot.com/en/amebapro2-arduino-video-mp4/
 */

#include "StreamIO.h"
#include "VideoStream.h"
#include "MP4Recording.h"

#define CHANNEL 0

// Default preset configurations for each video channel:
// Channel 0 : 1920 x 1080 30FPS H264
// Channel 1 : 1280 x 720  30FPS H264

VideoSetting config(CHANNEL);
MP4Recording mp4;
StreamIO videoStreamer(1, 1);    // 1 Input Video -> 1 Output RTSP

void setup()
{
    Serial.begin(115200);
    Serial3.begin(115200); 

    // Configure camera video channel with video format information
    Camera.configVideoChannel(CHANNEL, config);
    Camera.videoInit();

    // Configure MP4 with identical video format information
    // Configure MP4 recording settings
    mp4.configVideo(config);
    mp4.setRecordingDuration(30);
    mp4.setRecordingFileCount(1);
    mp4.setRecordingFileName("TestRecordingVideoOnly");
    mp4.setRecordingDataType(STORAGE_VIDEO);    // Set MP4 to record video only

    // Configure StreamIO object to stream data from video channel to MP4 recording
    videoStreamer.registerInput(Camera.getStream(CHANNEL));
    videoStreamer.registerOutput(mp4);
    if (videoStreamer.begin() != 0) {
        Serial.println("StreamIO link start failed");
    }

    // Start data stream from video channel
    Camera.channelBegin(CHANNEL);
    // Start recording MP4 data to SD card
    mp4.begin();

    delay(1000);
    printInfo();
}

void loop()
{
    // do nothing
    if (Serial3.available()) {
    char received = Serial3.read();     // Read incoming byte
    Serial3.print("Received: ");
    Serial3.println(received);          // Echo it back
  }
}

void printInfo(void)
{
    Serial.println("------------------------------");
    Serial.println("- Summary of Streaming -");
    Serial.println("------------------------------");
    Camera.printInfo();
    Serial.println("- MP4 Recording Information -");
    mp4.printInfo();
}

Thank you.

Sir my major concern is Can I use all three UART Ports Simultaneously While Recording?
Please see this code once…

/*
Example guide:
Multimedia – MP4 Recording – Realtek IoT/Wi-Fi MCU Solutions
*/

#include “StreamIO.h”
#include “VideoStream.h”
#include “MP4Recording.h”

#define CHANNEL 0

// Default preset configurations for each video channel:
// Channel 0 : 1920 x 1080 30FPS H264
// Channel 1 : 1280 x 720 30FPS H264

VideoSetting config(CHANNEL);
MP4Recording mp4;
StreamIO videoStreamer(1, 1); // 1 Input Video → 1 Output RTSP

void setup()
{
Serial.begin(115200);
Serial3.begin(115200);

// Configure camera video channel with video format information
Camera.configVideoChannel(CHANNEL, config);
Camera.videoInit();

// Configure MP4 with identical video format information
// Configure MP4 recording settings
mp4.configVideo(config);
mp4.setRecordingDuration(30);
mp4.setRecordingFileCount(1);
mp4.setRecordingFileName("TestRecordingVideoOnly");
mp4.setRecordingDataType(STORAGE_VIDEO);    // Set MP4 to record video only

// Configure StreamIO object to stream data from video channel to MP4 recording
videoStreamer.registerInput(Camera.getStream(CHANNEL));
videoStreamer.registerOutput(mp4);
if (videoStreamer.begin() != 0) {
    Serial.println("StreamIO link start failed");
}

// Start data stream from video channel
Camera.channelBegin(CHANNEL);
// Start recording MP4 data to SD card
mp4.begin();

delay(1000);
printInfo();

}

void loop()
{
if (Serial3.available()) {
char received = Serial3.read(); // Read incoming byte
Serial3.print("Received: ");
Serial3.println(received); // Echo it back
}
if (Serial1.available()) {
char received = Serial3.read(); // Read incoming byte
Serial1.print("Received: ");
Serial1.println(received); // Echo it back
}
if (Serial2.available()) {
char received = Serial3.read(); // Read incoming byte
Serial2.print("Received: ");
Serial2.println(received); // Echo it back
}
}

void printInfo(void)
{
Serial.println(“------------------------------”);
Serial.println(“- Summary of Streaming -”);
Serial.println(“------------------------------”);
Camera.printInfo();
Serial.println(“- MP4 Recording Information -”);
mp4.printInfo();
}

Hi @Pradumn_Porwal,

It should be possible, but your code has issues.

Please make sure that in your set up loop(), you initialize the three serial ports. Serial1.begin(); Serial2.begin() and Serial3.begin();

Also your loop code has issue too. I have modified for you below.

void loop()
{
if (Serial3.available()) {
char received_serial3 = Serial3.read(); // Read incoming byte
Serial3.print("Received: ");
Serial3.println(received_serial3); // Echo it back
}
if (Serial1.available()) {
char received_serial1 = Serial1.read(); // Read incoming byte
Serial1.print("Received: ");
Serial1.println(received_serial1); // Echo it back
}
if (Serial2.available()) {
char received_serial2 = Serial2.read(); // Read incoming byte
Serial2.print("Received: ");
Serial2.println(received_serial2); // Echo it back
}
}

void printInfo(void)
{
Serial.println(“------------------------------”);
Serial.println(“- Summary of Streaming -”);
Serial.println(“------------------------------”);
Camera.printInfo();
Serial.println(“- MP4 Recording Information -”);
mp4.printInfo();
}
1 Like