Teensy 3.5. Can I ad memory to the TX buffer?

Status
Not open for further replies.

laptophead

Well-known member
I'm sending a pretty long string on the TX4, blocking the run of the other processes.

I tried
uint8_t Serial5_buffer[128];

In the setup

Serial4.begin(115200); // Bluetooth HC05 to Win 10 Tablet
Serial4.addMemoryForWrite(Serial5_buffer, sizeof(Serial5_buffer));

This method worked wonders on my Teensy 4.1 but it won't compile for the 3.5.
Is there still a way?
If not, should I move this communication on another UART?
Thanks a lot
Mitch
 
You can still add the memory.
For a very long time now, it is possible to define it at compile-time. Many years ago, Paul merged my pulllrequest (thanks god ;-) )
Unfortunately, Arduino has no way to set it - but you can use *any* other IDE, as all but Arduino allow to set #defines at compile-time.
The existing code looks like this:
Code:
#ifndef SERIAL6_TX_BUFFER_SIZE
#define SERIAL6_TX_BUFFER_SIZE     40 // number of outgoing bytes to buffer
#endif
#ifndef SERIAL6_RX_BUFFER_SIZE
#define SERIAL6_RX_BUFFER_SIZE     64 // number of incoming bytes to buffer
#endif
(Here for Serial6)
So, just tell the compiler or make, or whereever you can set #defines to use a larger size.
On the commandline it would be something like
-DSERIAL6_TX_BUFFER_SIZE=128
So, take this as an encouragement not to use the Arduino-"IDE".
Platformio i.e. is nice.
Defragsters TSET can do it, too (IF you really want to use the Arduino-"IDE")

The worst way would be to edit the file... but should work, to.
 
Last edited:
@KurtE added those .addMemoryForWrite()'s when configuring the T_4.x's 7 or 8 Serial# ports. That didn't get replicated back to the T_3.x's.

You can still add the memory.
For a very long time now, it is possible to define it at compile-time. Many years ago, Paul merged my pulllrequest (thanks god ;-) )
Unfortunately, Arduino has no way to set it - but you can use *any* other IDE, as all but Arduino allow to set #defines at compile-time.
...

(Here for Serial6)
So, just tell the compiler or make, or whereever you can set #defines to use a larger size.
On the commandline it would be something like
-DSERIAL6_TX_BUFFER_SIZE=128
So, take this as an encouragement not to use the Arduino-"IDE".
Platformio i.e. is nice.
Defragsters TSET can do it, too (IF you really want to use the Arduino-"IDE")

The worst way would be to edit the file... but should work, to.

Perhaps I could add a placeholder in the source files that go to Compile.cmd where that would be added to the line : "%arduino%\arduino-builder" as "%user_defs%" in some fashion

It would get wiped on each rebuild of that - unless I checked and saw a "user_def.txt" file in sketchbook folder to concatenate in during assembly? Adding "set user_defs="

@FrankB - quick glance though I don't see a cmd line value to pass that through boards.txt to use during the build?
 
Status
Not open for further replies.
Back
Top