Updated of AMB82-mini board breaks working code

Hello. I have been having trouble with the latest updates, starting somewhere around 4.1.20251219, that causes the application to fail with error CH 0 MMF ENC Queue full, and consequent video corruption. Also, the whole interface is very slow to react in general. Version 4.1.20250911 still works fine, with high response and no errors. Interested to know what has caused this.

Regards,

Barry

Hi @Barryn56

Could you try again with the latest version 4.1.0-build20260123? Some video streaming bugs have been fixed.

Hi Pammy, no - same issue. I will install each board at a time and test to see when the issue originally arrived and let you know. My app uses HTTP to stream video to a phone over wifi, so I think it has something to do with the wifi side of things. Regards, Barry

Hi Pammy, so the problem occurred after the update to 20250911. This version works fine, and the next version, 20250924 has the problem. Is there a listing of changes somewhere?

Regards,

Barry

Hi @Barryn56 ,

All the changes are listed under these tags: Tags · Ameba-AIoT/ameba-arduino-pro2 · GitHub.

For 24 Sep version, it is under V4.1.0-QC-V02

OK, so lwip_send was changed, so this is the likely issue, as wi-fi bandwidth is not the issue. Possibly there’s a queue not being flushed??

Regards,

Barry

Hi @Barryn56 ,

Could you try modifying ard_socket.c by updating the send_data API to use the following implementation and check whether the performance returns to normal?

int send_data(int sock, const uint8_t *data, uint32_t len, int flag)
{
#if 1
    int ret;
    ret = lwip_send(sock, data, len, flag);
    return ret;
#else

// 1 TCP segment (1460 MSS size)
#define CHUNK_SIZE 512
    size_t offset = 0;
    ssize_t sent = 0;
    ssize_t total_sent = 0;
    size_t remaining, to_send;

    while (offset < len) {
        remaining = len - offset;
        to_send = remaining > CHUNK_SIZE ? CHUNK_SIZE : remaining;

        sent = lwip_send(sock, data + offset, to_send, 0);

        if (sent > 0) {
            offset += sent;
            total_sent += sent;
            sys_msleep(1);

        } else if (sent < 0 && (errno == EWOULDBLOCK || errno == EAGAIN)) {
            // socket not ready, wait for writable
            fd_set wfds;
            FD_ZERO(&wfds);
            FD_SET(sock, &wfds);

            // 20ms wait
            struct timeval tv = {0, 20000};
            int ret = lwip_select(sock + 1, NULL, &wfds, NULL, &tv);
            if (ret <= 0) {
                // timeout or error, retry
                continue;
            }
        } else {
            // real error
            return -1;
        }
    }
    // success
    return total_sent;
#endif
}

Thank you

Hi Pammy, yes - that’s stopped the error, though I notice that there’s a slight pause in the live streaming every few seconds, noticeable when moving the camera - maybe half a second the picture freezes, then ‘catches up’. I used the latest version of the board firmware. The other operations’ responsiveness are also back to normal.

Regards, Barry

Hi Pammy, so going back to 20250911, I notice that delay is less, but is still there, and likely due to the skb buffer reaching a limit under live streaming ([Driver]: skb_unavailable=1 in last 2 seconds). Can this be easily expanded or do you recommend switching to TCP, for example? Regards, Barry

OK - update. I was using an extension cable to go to the camera. When I removed that, and connected directly, the message about the skb_unavailable=1 in last 2 seconds has gone BUT the slight jitter remains, indicating it was not due to the buffer message. With this earlier board, the jitter is less than with the latest one (and updated ard_socket file). Regards, Barry

Final update - I tested the recording of the video onto SD card, and it is not affected by the slight jitter transmitted to the phone via wifi, so it’s not a significant problem for my application.

Regards,

Barry

1 Like

Hi Pammy - I spoke too soon! So another ‘bug’ I just noticed - my app shows a real time video and has a separate page for setting parameters. I just noticed that after showing the video and then going to set some parameters, when I come back to the video, it is blank. The new websocket fails. So I went back to an original board (March 2025) and the problem is not there. I am looking at moving up the boards to find when the problem occurs. Regards, Barry

Hi @Barryn56

May I know which version you are using that causing the video to be blanked? Have you tried on the latest prebuild version 4.1.0-build20260123?

Hi Pammy, yes, I was using the latest version, which you kindly fixed the intial problem with that patch you sent. It was only later that I noticed the current issue and thought I had a problem with my code not releasing the initial webserver. However, I couldn’t find the problem so went back to the older version and found the problem disappeared. I have not has time to check other versions at this time. Regards, Barry.

Hi @Barryn56 ,

Thank you for the update.

Just to let you know, we do have a Websocket viewer example included in the SDK recently, which you can explore and might be useful to you.

If you do get a chance to check other SDK versions later on and notice anything consistent, please feel free to let me know and I’ll be happy to look into it further.