[STM32GENERIC] SerialUSB Print(F( speed and availableForWrite()

Discussions about the STM32generic core
stevestrong
Posts: 1811
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [STM32GENERIC] SerialUSB speed and availableForWrite()

Post by stevestrong » Wed Jun 21, 2017 4:40 am

For libmaple this is the time for copying the strings to the Tx buffer.
Only at the 27th TEST... string gets the buffer full... :)

User avatar
Pito
Posts: 1625
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SerialUSB Print(F( speed and availableForWrite()

Post by Pito » Wed Jun 21, 2017 6:26 am

danieleff wrote:
Wed Jun 21, 2017 4:31 am
Libmaple has optimizes version of it

Code: Select all

size_t Print::print(const __FlashStringHelper *ifsh)
{
  return print(reinterpret_cast<const char *>(ifsh));
}
I only just used the vanilla arduino one with the loop. (Edit: I do not know why my was faster than your actually.)
This is with the "optimized libmable print F" routine:

Code: Select all

THIS IS A TEST THIS IS A TEST THIS IS A TEST THIS IS A TEST THIS IS A TEST
Elapsed with (F(: 37201 usecs

THIS IS A TEST THIS IS A TEST THIS IS A TEST THIS IS A TEST THIS IS A TEST
Elapsed: 40038 usecs
While debugging I see the USB's TxBuffer points to flash, so there is a chance it does not copy to ram and sends from there.
Experts have to doublecheck :)
Pukao Hats Cleaning Services Ltd.

Post Reply