ArduinoCore-sam icon indicating copy to clipboard operation
ArduinoCore-sam copied to clipboard

Additional SPI Interfaces using USART: SPI1, SPI2, etc.

Open TMRh20 opened this issue 8 years ago • 0 comments

This is mainly intended for Arduino Due, but I assume other boards could benefit from this also.

It seems that most if not all USARTs can be used in SPI Master mode, so with the Arduino Due, interfaces SPI1 & SPI2 can easily be provided via USART0 and USART1

The functionality is not so beneficial to the 328/Uno or 2560/Mega boards, due to limited interfaces and pins broken out on the board.

I would say some of the benefits are as follows:

  • Uses main female headers for SPI instead of icsp header to make Due more similar to Uno, Mega, etc.
  • Uses same type of male connecting wires/pins as used with Uno, Mega etc
  • Addresses problems with SPI devices that either don't play nice with other devices or sensitive/high speed devices like radio components that require very short leads
  • Reduced complexity with no need for additional Software SPI libraries
  • All of the above contribute to making the Due easier to interact with and more user friendly

These are some of the issues that I encountered when I first purchased a Due, since everything was so different, including a 3.3v vs 5v system, and I ended up leaving the Due on the shelf for quite a while.

The change requirements appear to be fairly minimal, with only a few lines in 4 files needing to change in my implementation. I've put together some (rough) POC code for Arduino: https://github.com/TMRh20/Arduino

I thought it best to ask if this would be considered for implementation before finalizing the code, including an additional SPI interface, and making a pull request.

The code is based on my SPI_UART driver for AVR/328, Mega & Due

Also a mandatory thanks to everybody that maintains these libraries, its been a blast using them so far!

TMRh20 avatar Nov 18 '16 00:11 TMRh20