Good day everyone,
I selected the FRDM-K22F for a personal project I am working on and am just getting started with it. First time working with ARM processors and eclipse. I'm going through the demos and have a bunch of them working successfully. Next I wanted to see if I could get an LCD screen working. I purchased a ili9341 board and attempted to run the LVGL demos provided in the SDK. Every time I try to run them, they fail with the error "touch panel init failed". I can't find any documentation or this error or the cause. I ran the emwin demo and it loaded up fine. I was really hoping to get LVGL working because it looks like a very powerful tool. Has anyone been successful or can offer any advice with this board and LVGL?
I got emwin to work by chance and figuring out the connections was difficult. The documentation just says "attach the LCD shield to the target board". I figured out the SPI pins from the pins tool, and connected RST to board reset and D/C to the GPIOA before it worked for emwin. Thanks in advance for any assistance!
Solved! Go to Solution.
Hi teddyp,
Do you run this code?
SDK_2.9.0_FRDM-K22F\boards\frdmk22f\littlevgl_examples\littlevgl_guider
From the code readme, you can know, it needs to use:
- Adafruit TFT LCD shield w/Cap Touch
So, that module should include both the ili9341 and the w/cap Touch.
If you just connect the ili9341, and no touch, then you will meet the lack touch issues.
You also can check the code, where you printf "touch panel init failed", it will contain the touch init, but your hardware lack the module, then it will report issues.
Please also note, the project has this note:
Known issue:
The MCU is not able to generate hardware reset of the LCD due to hardware limitation of the boards interconnection.
Because of this the LCD may not get initialized (stays blank) following a cold start (power on) of the board even if the demo was
correctly programmed to the FLASH memory. In such a case simply press the reset button to restart the demo.
In Rev D, the debug port UART and I2C for touch screen connect to the same pins, in this demo these two pins are used by I2C, PRINTF
function in the code can't work normally.
Supported board revisions:
FRDM-K22F REV A is not supported, the example is validated on REV C and D.
I think you also can comment the touch code, test the LCD code directly.
Wish it helps you!
Best Regards,
Kerry
Hi teddyp,
Do you run this code?
SDK_2.9.0_FRDM-K22F\boards\frdmk22f\littlevgl_examples\littlevgl_guider
From the code readme, you can know, it needs to use:
- Adafruit TFT LCD shield w/Cap Touch
So, that module should include both the ili9341 and the w/cap Touch.
If you just connect the ili9341, and no touch, then you will meet the lack touch issues.
You also can check the code, where you printf "touch panel init failed", it will contain the touch init, but your hardware lack the module, then it will report issues.
Please also note, the project has this note:
Known issue:
The MCU is not able to generate hardware reset of the LCD due to hardware limitation of the boards interconnection.
Because of this the LCD may not get initialized (stays blank) following a cold start (power on) of the board even if the demo was
correctly programmed to the FLASH memory. In such a case simply press the reset button to restart the demo.
In Rev D, the debug port UART and I2C for touch screen connect to the same pins, in this demo these two pins are used by I2C, PRINTF
function in the code can't work normally.
Supported board revisions:
FRDM-K22F REV A is not supported, the example is validated on REV C and D.
I think you also can comment the touch code, test the LCD code directly.
Wish it helps you!
Best Regards,
Kerry
Kerry,
It turns out that I did not have the adafruit touchscreen. I had another brand that included the ili9341 TFT controller, but instead of the FT6206, it has a TI HR2046 touchscreen controller. This controller needs to be programmed a completely different way that I don't have the expertise to complete. I ordered the adafruit screen, made the modifications noted here: https://community.nxp.com/t5/MCUXpresso-Community-Articles/Modifying-the-latest-Adafruit-2-8-quot-LC...
reset it and it started up fine. No issues. Thanks so much!
I thought I replied to this, but my reply isn't showing up for some reason, so I'll do it again.
|| Do you run this code?
|| SDK_2.9.0_FRDM-K22F\boards\frdmk22f\littlevgl_examples\littlevgl_guider
I attempted all three littlevgl examples (frdmk22f_littlevgl_demo_widgets, frdmk22f_littlevgl_demo_widgets_bm, and frdmk22f_littlevgl_guider) from the SDK along with frdmk22f_emwin_gui_demo. I get a greyed out screen with littlevgl and the emwin demo runs successfully. No touch capabilities on the emwin demo.
|| From the code readme, you can know, it needs to use:
|| - Adafruit TFT LCD shield w/Cap Touch
|| So, that module should include both the ili9341 and the w/cap Touch.
Correct. I have this module.
|| If you just connect the ili9341, and no touch, then you will meet the lack touch issues.
That makes sense. I'm just not sure where to connect the pins.
|| You also can check the code, where you printf "touch panel init failed", it will contain the touch init, but your hardware lack the module, then it will report issues.
My hardware has the module, I just guess I dont have it hooked up correctly.
|| Please also note, the project has this note:
|| Known issue:
|| The MCU is not able to generate hardware reset of the LCD due to hardware limitation of the boards interconnection.
|| Because of this the LCD may not get initialized (stays blank) following a cold start (power on) of the board even if the demo was
|| correctly programmed to the FLASH memory. In such a case simply press the reset button to restart the demo.
I eventually connected reset on the LCD module to the reset pin on the FRDM-K22F. Thats when the emwin demo loaded up.
|| In Rev D, the debug port UART and I2C for touch screen connect to the same pins, in this demo these two pins are used by I2C, PRINTF function in the code can't work normally.
Ok, that also makes sense. So I'm assuming I need to flash the board, disconnect from my computer and run with a usb power supply.
|| Supported board revisions:
|| FRDM-K22F REV A is not supported, the example is validated on REV C and D.
The board I have is rev D.
|| I think you also can comment the touch code, test the LCD code directly.
I actually went into \board\littlevgl_support.c and commented out lines 256, 259-262 as per your comment and it loaded up a single button on the screen, confirming that I don't have the touch panel hooked up correctly.
So, I'm confused about how to hook up this touch panel. I'm not sure if you have any experience with it.
Here is my current setup in which emwin works on and littlevgl works with the lines above commented out. I found it also works with J2(10) disconnected.
LCD-Pin============>FRDM-K22F
1/VCC==============>J25(10) 5V
2/GND==============>J25(12) GND
3/TFT_CS===========>J2(6) D10
4/REST=============>J25(6) RESET
5/TFT_D/C==========>J2(4) D9
6/TFT_SDI==========>J2(8) D11
7/TFT_SCK==========>J2(12) D13
8/LED==============>J25(10) 5V
9/TFT_SDO==========>J2(10) D12
10/T_CLK===========>No Connection
11/T_CS============>No Connection
12/T_DIN===========>No Connection
13/T_OUT===========>No Connection
14/T_IRQ===========>No Connection
I read a bunch of stuff about this LCD controller with respect to the arduino and they said they are connecting the touch pins to the same as the TFT pins. I then attempted the following:
LCD-Pin============>FRDM-K22F
1/VCC==============>J25(10) 5V
2/GND==============>J25(12) GND
3/TFT_CS===========>J2(6) D10
4/REST=============>J25(6) RESET
5/TFT_D/C==========>J2(4) D9
6/TFT_SDI==========>J2(8) D11
7/TFT_SCK==========>J2(12) D13
8/LED==============>J25(10) 5V
9/TFT_SDO==========>J2(10) D12
10/T_CLK===========>J2(12) D13
11/T_CS============>J2(6) D10
12/T_DIN===========>J2(8) D11
13/T_OUT===========>J2(10) D12
14/T_IRQ===========>No Connection
No success. I tried connecting the T_IRQ pin to J2(18)D14 and J2(20)D15 also with no success. I only see 7 pins initialized in the pin tool: BOARD_InitPins- GPIOA, but it doesnt say what for. DSP1_InitPins- These are the 4 SPI pins, PCS0/SS as chip select, SCK as serial clock, SOUT and Serial out and SIN as serial in. I2C_InitPins SDA and SCL. I'm not sure about these two. maybe I connect the SCL to T_CLK and SDA to T_OUT? or are you saying one of these is the irq pin that's referred to in littlevgl_support (BOARD_TOUCH_I2C_IRQ I2C1_IRQn)?
kerryzhou,
Thank you so much for the response! I'll answer each of your questions below:
|| Do you run this code?
|| SDK_2.9.0_FRDM-K22F\boards\frdmk22f\littlevgl_examples\littlevgl_guider
I attempted all three of the littlevgl examples (frdmk22f_littlevgl_demo_widgets, frdmk22f_littlevgl_demo_widgets_bm, frdmk22f_littlevgl_guider) and the emwin demo (frdmk22f_emwin_gui_demo) from SDK 2.9.0. I actually downloaded every single available SDK module just in case. As stated previously, the emwin demo worked and the same behavior (touch panel init failed) was received from all the littlevgl demos.
|| From the code readme, you can know, it needs to use:
||
|| - Adafruit TFT LCD shield w/Cap Touch
||
|| So, that module should include both the ili9341 and the w/cap Touch.
Correct and I have the Adafruit TFT LCD Shield w/Cap Touch. It has the ili9341 controller.
Here are my current connections
Adafruit TFT LCD Pin ==========> FRDM-K22F dev board Rev D
1- VCC =========================> J25 Pin 10 - 5V
2- GND =========================> J25 Pin 12 - GND
3- TFT_CS ======================> J2 Pin 6/D10 - SPI1_PCS0
4- RESET =======================> J25 Pin 6 - RST
5- TFT_D/C =====================> J2 Pin 4/D9 - PTA1 in Pins
6- TFT_SCI =====================> J2 Pin 8/D11 - SPI1_SOUT
7- TFT_SCK =====================> J2 Pin 12/D13 - SPI1_SCK
8- LED =========================> J25 Pin 10 - 5V
9- TFT_SDO =====================> J2 Pin 10/D12 - SPI1_SIN
10- T_CLK ======================> No Connection
11- T_CS =======================> No Connection
12- T_DIN ======================> No Connection
13- T_DOUT =====================> No Connection
14- T_IRQ ======================> No Connection
|| If you just connect the ili9341, and no touch, then you will meet the lack touch issues.
|| You also can check the code, where you printf "touch panel init failed", it will contain the touch init, but your hardware lack the module, then it will report issues.
Makes sense. So the error is because I don't have the touch portion connected.
|| Please also note, the project has this note:
|| Known issue:
|| The MCU is not able to generate hardware reset of the LCD due to hardware limitation of the boards interconnection.
|| Because of this the LCD may not get initialized (stays blank) following a cold start (power on) of the board even if the demo was
|| correctly programmed to the FLASH memory. In such a case simply press the reset button to restart the demo.
Yeah, I read that in the docs. It was one of the reasons I connected the LCD reset to the FRDM-K22F reset.
|| In Rev D, the debug port UART and I2C for touch screen connect to the same pins, in this demo these two pins are used by I2C, PRINTF
|| function in the code can't work normally.
Ok, so you're saying that pin 1 {FRDM Expansion J2[18](D14)} and pin 2 {FRDM Expansion J2[20](D15)} need to be connected to the touch panel portion. I guess what I dont understand is that there are 5 pins on the board and this is only two. All the demos of people using it with an arduino, they hook up all 5 pins. The pins setup in MCUXpresso also doesn't list any more active pins. between BOARD_InitPins, DSPI1_InitPins and I2C1_InitPins, 7 pins are initialized. Since I know the emwin demo runs, I am going to assume I have pins 1-9 on the LCD screen connected correctly (1-8 actually, I found out I didn't need LCD SDO(MISO) connected to SPI1_SIN to make the emwin demo run), so I need to connect the touch pins 10-14 to something.
|| Supported board revisions:
|| FRDM-K22F REV A is not supported, the example is validated on REV C and D.
I do have board REV D.
|| I think you also can comment the touch code, test the LCD code directly.
Based upon this comment, I did some playing around. Ended up commenting out lines 256 & 259-262 in frdmk22f_littlevgl_guider\board\littlevgl_support.c The screen came up with a single button. This is the best start I've gotten so far. Any more ideas on how to get the touch screen working? I'll continue to experiment. Thanks again for your help!