New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library enhancement request #2013
Comments
This issue has been posted several times. Mainly due to backward compatibility it has been rejected. The SPI interface in Arduino is poorly designed and has resulted in libraries not being able to be used together. A total redesign is needed. This is what I have done for Cosa; https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/SPI.hh The Cosa SPI class does the following;
Please see the Cosa Ethernet Controller driver for W5100 for an example of usage; https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Socket/Driver/W5100.cpp#L53 Another example is the Cosa ST7735 262K Color Single-Chip TFT Controller. Please note that the Cosa SPI begin/end block allows three different type of chip select pulses; 1) assert low, 2) assert high, and 3) high pulse on end. The last variant is used for shift-registers. Please see the Cosa shift-register 3-wire SPI LCD adapter for an example of this pulse(2) variant, https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780_IO_SR3WSPI.cpp#L50 |
Mikael, Thanks for your reply. The backward compatibility issue is not obvious. I am curious, can you explain? Thanks. -Dave On Apr 14, 2014, at 7:36 PM, Mikael Patel notifications@github.com wrote:
|
The optimum solution would be if this issue could be fixed without an impact on existing libraries that use SPI. Therefore backward compatibility. It is all about how much effort the Arduino Team can put on the software platform. One must remember that Arduino as a product line only makes money on the boards sold. The software is all minimum effort, badly documented, poor performance, high complexity and low abstraction. And most of all hard to maintain. The great thing about the Arduino is the community and the contributions. This is also the Achilles heel as libraries are often abandon by the authors. They do not make any money at all if they do not design and sell a piece of hardware. We need to remember that industry strength software (which we are all expecting) cost approx. $100 per line of code. That needs to cover design, test, documentation, etc. Changing the SPI interface to something like what is available in Linux, Windows, RTOS, etc requires several hundred hours effort which basically the Arduino team does not have at their disposal. The SPI library change is actually not that large in lines of code but the ripple effect is. Unfortunately this makes the issue more or less "dead in the water". Right now the issue is also on the developers mailing list (again). Cheers! |
@mikaelpatel it was solved with SPI Transacion API! |
Please consider modifying the Ethernet and Wifi libraries (and others as appropriate) to set the SPCR to the required value in every entry point into the library that uses SPI. The SPCR could have changed value between calls to the library (e.g. the user has another device on the SPI bus). The current situation requires the user to read the library code to determine the required SPI settings and write code to set the SPCR prior to each call into the library. Its seems natural that the library should manage its own SPI settings.
The text was updated successfully, but these errors were encountered: