TWR-LCD with eGUI (D4D) and MQX on TWR-K70F120M

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TWR-LCD with eGUI (D4D) and MQX on TWR-K70F120M

2,235 Views
friederschrempf
Contributor IV

I'm trying to set up a TWR-LCD Module on a TWR-K70F120M using MQX 4.0 and the eGUI D4D driver.

I configured the d4d_user_config.h to use SPI on MQX and the SSD1289 controller.

I checked the D/C and CS signals and the DIP switches, still I can't see anything on the screen.

On the scope I noticed the SCK signal keeping on clocking another 16 times with DATA=0 although 16 bits have already been send with "fwrite ( &p_color, 2, 1, spi_fd);", what seems strange to me.

I compared to the SCK signal produced by the TWR-LCD onboard CPU with the working JM128_BL_EGUI_SPI example which does not have this extra "empty word" beeing sent.

The eGUI version 2.1 seems to have support for K60 devices. What changes are needed to get the K70 working under MQX?

Can anybody help me? Does someone have some code already running for my setup?

Thanks!

Labels (1)
0 Kudos
10 Replies

967 Views
big_steve
Contributor III

I have the same problem on my TWR-K40X256. I can't get to work an LCD display on TWR-LCD module with SPI communication. EBI works fine but i can't use it.


I am using MQX4 and eGUI3.0.
Under MQX3.7 and older eGUI my project worked.

0 Kudos

967 Views
Gargy
NXP Employee
NXP Employee

Hi, look at the Pavel Chromy solution.

Petr

0 Kudos

967 Views
big_steve
Contributor III

I tried it but it still doesn't work.
I try to solve it other way. I 'll make EBI pins free, and connect my sensors to other pins.
My sensors are connected to pins B76..B80. They shouldn't be used for EBI acording to TWR-LCD datasheet but when my sensor are connected to B76..B80 pins LCD doesn't work. It looks so that B76..B80 are with A76..A80 somehow connected.

Yesterday i started about that a new topic: Are pins B73..B80 used by EBI of TWR-LCD?

0 Kudos

967 Views
pavel_chromy
NXP Employee
NXP Employee

Dear Frieder,

the behavior described is caused by a bug in the 4.0 DSPI driver (spi_dspi_c, line 562).

Please apply the patch below to solves the issue. This change is going to be included in 4.0.2 release.

Best regards,

  Pavel

diff --git a/mqx/source/io/spi/spi_dspi.c b/mqx/source/io/spi/spi_dspi.c
index 1657484..62f03f4 100644
--- a/mqx/source/io/spi/spi_dspi.c
+++ b/mqx/source/io/spi/spi_dspi.c
@@ -559,7 +559,7 @@ static _mqx_int _dspi_tx_rx
     if (DSPI_CTAR_FMSZ_GET(dspi_ptr->CTAR[0]) > 7)
     {
         len = len & (~1UL);
-        rx_len = tx_len = len;
+        rx_len = tx_len = len/2;

         while (rx_len)
         {


0 Kudos

967 Views
friederschrempf
Contributor IV

Thank you for the hint.

This fix indeed solves the problem that too much SPI frames are sent.

But I still can't get the LCD working with standard SPI driver.

Is there a possibility to enable CS signal toggling? This option exists in the Processor Expert SPI component, but I can't see it in the standard SPI driver. The CS signal stays active constantly.

Using the PE SPI component I succeeded in getting a picture on the screen, but there still remain some pixel and color errors.

0 Kudos

967 Views
pavel_chromy
NXP Employee
NXP Employee

Dear Frieder,

CS toggling is a specific feature of DSPI and thus it is not part of the generic SPI API, however it might be implemented as a DSPI specific IOCTL in the future. As for now the only way to toggle CS is to write words one by one followed by a call to fflush.

If you are still experiencing problems even with PE driver with toggling I recommend you to have a look for the check the wiring or PCB routing, especially check the CLK signal with a scope and/or logical analyser.

If there is an issue with SCK signal, lowering the baudrate might help.

Best regards,

  Pavel

0 Kudos

967 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

EGUI for K70 is working by default with TWR-LCD-RGB, using LCDC module. TWR-LCD could also work, but you need to do some hardware rework if you want to enable the Touch screen. I suggest you to use TWR-LCD-RGB with TWR-K70

Luis

0 Kudos

967 Views
friederschrempf
Contributor IV

Thank you for your reply. I know of the K70 supporting direct LCDC control.

In the moment I just want to use the display I already have. To me this seems more like a SPI problem. I exchanged the "fwrite ( &p_color, 2, 1, spi_fd);" command in the D4D driver with the send command of the Processor Expert SPI component. Now I get something on the screen at least, but the picture is a real mess and not what it supposed to look like.

0 Kudos

967 Views
Gargy
NXP Employee
NXP Employee

Hello,

I'm so sorry for the MQX behaviour, maybe It could be interesting see the code and scope screen shot.

But back to the eGUI, some time ago I did one example on K70 and TWR-LCD so at least in attachment you could find my configuration files.

The project runs on MQX 3.8.


Best regards

Petr

0 Kudos

967 Views
friederschrempf
Contributor IV

Thank you for your support.

The code is from unmodified d4dlcdhw_mqx_spi.c file. The SPI frame size is set to 16 bits. Then a word is sent with fwrite ( &p_color, 2, 1, spi_fd). I expect one burst of 16 bits on the SPI port. Instead I get two bursts with 16 bit, one containing the high-byte and an empty byte and one containing the low byte and an empty byte.

Unfortunately I can't post a scope screen.

Thank you for your config files. Unfortunately they are the same as the unmodified files that I already tested. Are you sure that you used them with K70 as there are only directives for K40 and K60 set in d4dlcdhw_mqx_spi_cfg?

Regards

Frieder

0 Kudos