Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 9 months ago.
9 bits mode supported in SPI interface ?
Hi there,
I just want to make sure that this board can support 9 bits SPI mode or not. There is a Nokia 6100 LCD shield that uses 9 bits mode. Does it fit in with this board?
Question relating to:
2 Answers
10 years, 9 months ago.
No, the SPI can only support 8 or 16-bit mode on the KL46Z. Of course you can use software SPI, although that is not as handy as hardware SPI. (For example: http://mbed.org/users/davervw/code/SWSPI/)
10 years, 9 months ago.
Hi Erik,
I have tried the SWSPI lib, and though I can compile my code, the LCD did not work. The error message output to PC via serial port is : "Only 8/16 bits".
Here is my code:
SWSPI and NokiaLCD
#include "mbed.h" #include "NokiaLCD.h" #include "SWSPI.h" SWSPI swspi(D11, D12, D13); NokiaLCD lcd6100(D11, D13, D9, D8, NokiaLCD::LCD6100); DigitalOut led(LED2); int main() { swspi.format(9, 0); swspi.frequency(10000000); while(1) { led = 1; wait(0.2); led = 0; wait(0.2); printf("this is a test. \n\r"); lcd6100.printf("this is a test \n\r"); } }
Where did I go wrong?
How to bind SWSPI with NokiaLCD together?
You aren't actually using the SWSPI. In the NokiaLCD library it makes an SPI class (at least I assume it does). You need to replace that one by SWSPI, now it still uses the regular SPI there, and it gives the error that it only supports the 8/16-bit of the KL46z hardware SPI.
posted by 17 Feb 2014Hi Erik,
You means I have to rewrite the NokiaLCD class, that's right? OK, I will figure out how to do that.
Thanks for your advice.
jppang
posted by 17 Feb 2014Hi Erik,
I have rewritten the orginal NokiaLCD lib by using the SWSPI lib. It works!
Finally, I can play with this LCD shield on KL25Z and KL46Z boards.
Here is the link to my code.
Import programKL46Z_NokiaLCD
Rewrite the NokiaLCD lib by using the SWSPI lib in order to fit in with the 9 bits SPI mode of KL46Z.
Thanks again.
posted by 18 Feb 2014