why the maximum length of serial.available() is 32

Hi, yes, this is a bug, I’ll tell you the way to fix it here, and we’ll fix the SDK in the next version.

Open this file:

hardware\arduino\mtk\cores\arduino\UARTClass.cpp

In line 42 and line 47, there’s a num 32, change it to ERIAL_BUFFER_SIZE:

[code]void UartIrqHandler(void* parameter, VM_DCL_EVENT event, VM_DCL_HANDLE device_handle)
{
if(event == VM_UART_READY_TO_READ)
{
char data[SERIAL_BUFFER_SIZE];
int i;
VM_DCL_STATUS status;
VM_DCL_BUFF_LEN returned_len;

    status = vm_dcl_read(device_handle,(VM_DCL_BUFF*)data,SERIAL_BUFFER_SIZE,&returned_len,vm_dcl_get_ownerid());
    if(status<VM_DCL_STATUS_OK)
    {
        vm_log_info((char*)"read failed");
    }  
    if(device_handle == g_APinDescription[0].ulHandle)
    {
        for(i=0;i<returned_len;i++)
        {
            Serial1._rx_buffer->store_char(data[i]);
        }
    }
    else
    {
        for(i=0;i<returned_len;i++)
        {
            Serial._rx_buffer->store_char(data[i]);
        }
    }
}
else
{
}

}
[/code]

Then the serial buff will change to SERIAL_BUFFER_SIZE, it’s 64 now, you can modify it here:
hardware/arduino/mtk/cores/arduino/RingBuffer.h

Please have a try, I test it ok here, thanks.