Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

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

  1. #1
    Senior Member
    Join Date
    Dec 2016
    Location
    Buena Park ca
    Posts
    124

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

    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

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Buena Park ca
    Posts
    124
    I get 'class HardwareSerial4' has no member named 'addMemoryForWrite'

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,511
    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 by Frank B; 12-08-2020 at 10:42 PM.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,122
    @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.

    Quote Originally Posted by Frank B View Post
    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?

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,177
    Next teensyduino beta will have the addMem... functions for T3.x ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •