Argon UART max throughput?

I’m thinking of using an argon for a product that requires UART connectivity of up to 250 kBPS. Is that reasonably achievable on the argon? (I know this is a firmware and hardware issue, but I’m guessing that firmware is the limiting factor here.)

Have you tried Serial1.begin(250000)?

I don’t have one yet to try, I’m hoping that somebody will know the answer before I try it out. I do have another similar board, the Adafruit Feather nrf52840, but it doesn’t write faster than 49 kbps no matter what I set the serial baud rate to. My understanding is that the mcu itself can go to 1Mbps, so I assume the Feather has a firmware issue.

With this test code running on two Borons (should behave like Argons, even with slightly lower performance when connected to the cloud) I could get a mostly stable connection

#define _SENDER

const char str[] = "<abcdefghijklmnopqrstuvwxyz>";

SerialLogHandler logger(LOG_LEVEL_ERROR, {{ "app", LOG_LEVEL_INFO }});

#ifdef SENDER
SYSTEM_MODE(MANUAL)                                             // sender running without cloud connection

void loop() {
  Serial1.print(str);                                           // clocking out data at max speed
}
#else // ----- RECEIVER                                      
SYSTEM_MODE(AUTOMATIC)                                          // receiver running with cloud

void loop() {
  size_t n;
  char in[sizeof(str)];
  Serial1.find("<");                                            // wait for start of message < (we need some sync signal)
  n = Serial1.readBytesUntil('>', in, sizeof(in));              // read the rest of the message, we synced on
  digitalWriteFast(D7, strncmp(in, str+1, strlen(str+1)-1));    // indicate error with D7 ON
  if (digitalRead(D7)) {                                        // when error detected
    Log.info("Error: %*s", n, in);                              //   print out erroneous receipt
    while(Serial1.read() >= 0);                                 //   flush RX buffer
  }
}
#endif

void setup() {
  pinMode(D7, OUTPUT);
  Serial1.begin(250000);
  Serial1.println("Init");
}

This is the log for a 5 minute run

[ms since init]
0000055366 [app] INFO: Error: abghijklmnopqrstuvwxyz
0000179526 [app] INFO: Error: abcdefghijkqrstuvwxyz
0000241802 [app] INFO: Error: abcdefvwxyz
0000295584 [app] INFO: Error: abcdefghijklmnoprstuvwxyzh
0000389547 [app] INFO: Error: apqrstuvwxyz
0000399548 [app] INFO: Error: abcdefghijklmnopqrstuxyzHh

The error reports probably are mostly related to times where the transmission “collided” with some cellular/cloud activity.
When running the receiver in MANUAL mode the connection is much more stable.

An additional test scenario could log how many often a resync caused some TX data to be dropped.

Without knowing anything about your actual data source it’s difficult to tell whether this would pose an issue or not.

1 Like

@occamman, you have asked about the data rate (250Kbps) but you have yet to explain what the throughput requirements are. That is, how much data will be Argon be required to handle in a given interval. For example, will the Argon handle one message “packet” of 100bytes at 250Kpbs every second? Or will it be a sustained stream of data at 250Kbps?

On the processing side, will the Argon be required to process the data, such as command and data decoding, etc?

The throughput takes into account all these factors in order to define the actual ability of the Argon to handle incoming or outgoing data at the desired 250Kbps.

One item not yet discussed is the ability to define your own (larger than 64byte) buffer for the Serial1 port using acquireSerial1Buffer(). The extra buffering can help with throughput if properly managed (data is processed fast enough not to overflow the buffer).

1 Like