Go Down

Topic: SPI Speed & Flash string (Read 3356 times) previous topic - next topic

x-giorgio-x

Hi
Max speed of the SPI is 12Mhz.
For obtain 24Mhz I change IDE souces code at line 45
https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/SPI/SPI.h

Exist a way for obtain same speed without changing the IDE file?


Second question.


About Print, ex TFT.print() file.print() serial.print()
https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/Print.cpp

There are 2 function ? One for print String from ram and one from flash ?
This ?
size_t Print::print(const __FlashStringHelper *ifsh)
size_t Print::print(const String &s)


is right if i say:

print("hello")
string is copied from flash to ram, ad startup, then print from ram.

print(F"hello")
string is printed direclty from flash

Naturally, all this is intended with ARM SAMD

x-giorgio-x

No, booth of this are const = Flash.
Explain me.


size_t Print::print(const __FlashStringHelper *ifsh)
size_t Print::print(const String &s)

x-giorgio-x

This post read 880 time and nobody gives me advice?

#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

I found this but I do not understand.

westfw

Quote
No, booth of this are const = Flash.  Explain me.

size_t Print::print(const __FlashStringHelper *ifsh)
size_t Print::print(const String &s)
They would be different on an AVR, so both versions exist for the sake of compatibility.
As for SPI, the library says:
Quote
// New programs should use SPI.beginTransaction to set the SPI clock
See https://www.arduino.cc/en/Reference/SPISettings
I don't think that the original SPI code had beginTransaction(), so many of the examples don't use it.

x-giorgio-x

Max speeed, using original library is 12mhz

Go Up