cancel
Showing results for 
Search instead for 
Did you mean: 

STM32duino: Serial Seiral1 etc RXBuffer size

caixf
Associate II

I using STM32duino to program the STM32F103C8T6. When I use the Seiral1 to communicate with a 4G, the data reveived exceeds 64 characters, data will lost. By using modify the following #defines, it does not working. I am appreciated if somebody could help. The folowing test prgram file is as following:

#define SERIAL_RX_BUFFER_SIZE 1024
#include <Arduino.h>


char str[] = "config,netchaninfo,ok,tcp,uart,0,0,00,60,47.192.1.114,22004,0,,0,,0,,0,0";
char *endptr;

uint8_t uxBuffer[256] = {0};
uint16_t uxLen = 0;
uint8_t timeout = 20;
uint8_t ux = 0;

long long x64 = 869020060303565;
long long x64_1 = 0;

void setup()
{
    Serial.begin(115200);
    delay(5000);
    //int x = SERIAL_TX_BUFFER_SIZE;
    Serial.printf("SERIAL TX BUFFER SIZE = %d\n", SERIAL_TX_BUFFER_SIZE);
    Serial.printf("%s\n", str);
    Serial.printf("size of str = %d\n", sizeof(str));

}

void loop()
{
    if ( Serial.available())
    {
        ux++;
        if ( ux > timeout)
        {
            uxLen = Serial.available();
            Serial.printf("string len = %d\n", uxLen);
            ux = 0;
            for ( int i = 0; i < uxLen; i++)
            {
                uxBuffer[i] = Serial.read();
            }
        }
    }
}
3 REPLIES 3
Pavel A.
Evangelist III

Here you can find help and advice on your project.

Please see How to insert source code.

 


@caixf wrote:

I using STM32duino


Then this is the place to post: https://www.stm32duino.com/

Maybe also in the Arduino forums: https://forum.arduino.cc/

 

Note that these forums will also have requirements for posting source code to keep it legible.

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
caixf
Associate II

@Andrew Neil 

Thank you for your information.