Hello,
I stick with a problem since days, maybe one of the community knows a solution. I want to use Panda2 board with Display edip240-7 (www.lcd-module.de/pdf/grafik/edip240-7.pdf) connecting by SPI1. Between Panda2 and Display is a ADUM1200/ADUM1201 to convert signals from/to 5V. The Display is working as yet on an Atmega8515 on SPI too, so far the display is ok.
And that is the problem: After transfering a command to display, it has to answer with ACK (=6). Then I could send the next command. The display seems to understand the transferred command correct without any delay, because I can see the result by changing display output immediately. But I do not get back an ACK (=6), I get regulary back an 127 or an 131 or an 138. And so I have to wait for the timeout before sending new commands, not to talk about reading the touch, which is impossible too. I think, I make a mistake with my SPI commands.
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
namespace Edip240_Test_SPI1
{
public class Program
{
public static void Main()
{
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
SPI.Configuration EDIP240 = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di45, false, 10, 10, true, false, 1, SPI.SPI_module.SPI1);
SPI Display = new SPI(EDIP240);
byte[] command = new byte[13] { 0x11, 0xa, 0x1b, 0x44, 0x4c, 0x1b, 0x47, 0x44, 0x00, 0x00, 0xef, 0x7f, 0xda }; //edip240
byte[] Dummybyte = new byte[4] { 0x11, 0x1, 0xFF, 0x12 };
byte[] Response_command = new byte[13];
byte[] Response_Dummybyte = new byte[4];
Display.WriteRead(command, Response_command);
uint i = 0;
while (i<command.Length)
{
Debug.Print(Response_command[i].ToString());
i++;
}
Thread.Sleep(10);
Debug.Print("ACK abfragen");
Display.WriteRead(Dummybyte, Response_Dummybyte);
i = 0;
while (i < Dummybyte.Length)
{
Debug.Print(Response_Dummybyte[i].ToString());
i++;
}
Thread.Sleep(10);
Debug.Print("ACK nach Wartezeit nochmal abfragen");
Display.WriteRead(Dummybyte, Response_Dummybyte);
i = 0;
while (i < Dummybyte.Length)
{
Debug.Print(Response_Dummybyte[i].ToString());
i++;
}
// toggle LED state
ledState = !ledState;
led.Write(ledState);
}
}
}
I checked the same by using the COM3, connected by ADUM1201 too for converting voltage, and it works without any problem. When I request display answer after 10 ms, ACK (=6) will get delivered immediately. There is the working code for COM3.
using System;
using System.Threading;
using System.IO.Ports;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
namespace Edip240_Test_COM3
{
public class Program
{
public static void Main()
{
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
SerialPort UART;
UART = new SerialPort("COM3", 9600);
byte[] rx_data_Display = new byte[1];
byte[] command = new byte[13] { 0x11, 0xa, 0x1b, 0x44, 0x4c, 0x1b, 0x47, 0x44, 0x00, 0x00, 0xef, 0x7f, 0xda }; //edip240
UART.Open();
UART.Write(command, 0, command.Length);
Thread.Sleep(10);
UART.Read(rx_data_Display, 0, rx_data_Display.Length);
UART.Close();
Debug.Print(rx_data_Display[0].ToString());
// toggle LED state
ledState = !ledState;
led.Write(ledState);
}
}
}
Does anybody has an idea, how to make it working by SPI? What is my mistake?
Thanks, Ralf