| urbantigerau
|
Use of hardware based SPI on ArduinoPosted at:2018-12-28 10:31:40
|
|
Hi , I just received my my 1.8" TFT LCD 160x128 Display Module and have had it running on both I2C and SPI. It is a very nice unit and and seems very versatile. The library looks powerful.Good job. I note that the SPI interface is based around software SPI, not the hardware based SPI solution offered by Arduino SPI.h. I attenmpted a convertsion to SPI.h by modifying DigoleSerial.h to use SPI.h instead of Shiftout. As far as I can see the only rotines which need to change are write and read1. The fragment below shows what I did. I was hoping that it might have worked to some extent, but it does not. #if defined(_Digole_Serial_SPI_) Three points: I have been unkind to version 33 since I don't need to support it. Not good for a final solution however. SPI.h is included from the main file ( testallfunctions). I think the defaults for the SPI setting as to bit endian and so on is right at the default. However this might be a source of problems. The program testallfunctions compiles but fails to run correctly. Something is not right about the hardware SPI I suspect. Before I break out my oscilloscope and start probing about maybe you can tell me if this is a fool's errand and will never work for some reason. The reason I ask is that the display was to fit into a much larger project designed ground up around mutliple devices on hardware SPI. Pins are not plentiful in a tight design and to allocate 3 for a software SPI is a luxury I don't have. Also it is a time critical application running with both timers generating interrupts and pin change interrupts, not to mention an incessant stream of serial data from a GPS unit feeding a hardware serial port. Waiting for software SPI is not a great outcome and will cause perceptable lags for some functions and likely corruption of the GPS data. I2C is undesireable also from the pin point of view. I don't have a lot to spare. I note that the I2C interface uses the Arduino I2C library! I suggest that using any form of software interface to hardware when a hardware solution is available isn't ideal and will cause potential users like me to baulk when they see the limitations. Hoping you can solve this one easily with a conversion to hardware SPI. Regards. |
