I bough a color LCD shield (http://www.sparkfun.com/products/9363) and I have a little problem to drive it: the spi needs a 9 bits data lenght. 8 or 16 bits data are available in the framework, but how to use 9 bits data? I’m using a panda II.
Do I need to program directly the registers of the microcontroler?
The .NETMF library only supports 8 or 16 bits. The Panda’s chip can do 8, 9 … 16 bits, but you would have to program the SPI (just a few lines) in RLP (i.e. Native mode). A nice exercise in RLP.
Take a look at the LPC2387 datasheet for the register S0SPCR (for SPI1).
GHI actually added a little trick to support 9bit particularly for this display. The way this display work with “byte and half” for even pixels and “half and byte” for odd pixels makes it horribly slow compared to other displays like this one http://www.ghielectronics.com/catalog/product/262
Also, the picture quality of this nokia display is very bad! For all these reasons we stopped supporting this display.
I highly recommend FEZ Touch if you own FEZ Panda II
[quote]The right way to do this is by writing RLP drivers specifically for your display. Which will make it run very fast.[/quote]sure, but it’s not a piece of cake to write driver without any debugging possibility.
What the best toolchain? I’ve fund yagarto and code sourcery.
You could always buy another TFT - maybe faster and cheaper than struggling, although the RLP -route will help you later as well.
Yagarto will be fine. There are loads of code examples for peripherals at NXP
[quote]I think we found the code we used for the nokia display. We will update and post on code-share in couple days [/quote]Nice! Thanks
[quote]You could always buy another TFT - maybe faster and cheaper than struggling[/quote]you’re right, but I’ve bough 2 pieces.
Now, I’m trying to understand how to get and set registers with the register class. I wrote this code to take a look about the spi registers content:
namespace FEZ_Panda_II_LCD
{
public class Program
{
public static void Main()
{
// Blink board LED
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
SPI.Configuration MyConfig1 = new SPI.Configuration(
(Cpu.Pin)FEZ_Pin.Digital.Di9, // CS sur patte 9
false, // SS actif bas
0, // pas de setup time
0, // pas de hold time
true, // clock à 1 au repos
true, // donnée valide sur front montant de l'horloge
1000, // 1000 kHz
SPI.SPI_module.SPI1); // SPI 1
SPI MySPI1 = new SPI(MyConfig1);
Register S0SPCR = new Register(0xE0020000);
Register S0SPCCR = new Register(0xE002000C);
Register SSP0CR0 = new Register(0xE0068000);
Register SSP0CR1 = new Register(0xE0068004);
Register SSP1CR0 = new Register(0xE0030000);
Register SSP1CR1 = new Register(0xE0030004);
while (true)
{
// Sleep for 500 milliseconds
Thread.Sleep(500);
Debug.Print("S0SPCR = " + S0SPCR.Read().ToString());
Debug.Print("S0SPCCR = " + S0SPCCR.Read().ToString());
Debug.Print("SSP0CR0 = " + SSP0CR0.Read().ToString());
Debug.Print("SSP0CR1 = " + SSP0CR1.Read().ToString());
Debug.Print("SSP1CR0 = " + SSP1CR0.Read().ToString());
Debug.Print("SSP1CR1 = " + SSP1CR1.Read().ToString());
}
}
}
}
the response is always 0. What is wrong in the code?
but can you explain to me how the 3rd and 4th parameters can now configure le 9th bit mode of the spi?
The spi.configure documentation says that these parameters set the chip select setup and hold time.
I added more description to the page. This code is provided as reference only. This is a very bad display and we no longer support it, the code is there but you are on your own