Lib for the new LCD Display with ILI9341 controller

Dependents:   TFT_Test_ILI9341 touch_piirto TFT_banggood TFT_Test_ILI9341-a-fish ... more

Issue: Does not seem to work with USBSerial, InterruptIn, or additional SPI peripherals on FRDM-KL25Z

Whenever I initialize an InterruptIn or USBSerial or any additional SPI peripherals, it completely breaks the display output.

Here is my test code:

#include "mbed.h"
#include "SPI_TFT_ILI9341.h"
#include "Arial12x12.h"
#include "USBSerial.h"

DigitalOut toDoPin(PTB18);
SPI_TFT_ILI9341 TFT(PTC7, PTC6, PTD1, PTE31, PTE24, PTE25, "TFT"); //mosi, miso, sclk, cs, reset, dc  
//SPI adcSPI(PTC7, PTC6, PTD1); // mosi, miso, sck
DigitalOut adcCS(PTB18);
DigitalOut adcReset(PTB3);
//InterruptIn doThing(PTB19);
//USBSerial usbSerial;

void display_setup(void){
    TFT.set_orientation(1);
    TFT.background(Black);
    TFT.foreground(White);
    TFT.cls();        
    }

void update_display(void){
    TFT.set_font((unsigned char*) Arial12x12);
    TFT.foreground(Red);
    TFT.locate(25,30);
    TFT.printf("TEST"); 
    }
        
void toDo(void){
    toDoPin = !toDoPin;
    }

int main() {
//    doThing.rise(&toDo);
    display_setup();
 
    while (1){
        update_display();
    }
}

This produces the desired display output:

https://i.imgsafe.org/0ca9e410b4.jpg

However, uncommenting either the InterruptIn or USBSerial declarations (or both) produces an errant display output:

https://i.imgsafe.org/0caa1a86c3.jpg

Uncommenting the additional SPI peripheral initialization (while leaving the InterruptIn and USBSerial declarations commented out) produces a different errant output:

https://i.imgsafe.org/0ca9f02a13.jpg

Using a FRDM-KL25Z. All libraries are up to date.

1 comment:

28 Oct 2016

The InterruptIn issue is my fault, the FRDM-KL25Z does not allow interrupts on Port B, only Ports A and D (per: https://developer.mbed.org/handbook/InterruptIn#interface).

However, I have not been able to resolve the issue with sharing the SPI bus with additional peripherals, nor with using USBSerial.

Edit: Apparently the issue with USBSerial was due to that library's blocking characteristics, and not an issue with the SPI_TFT_ILI9341 library. (For anyone else encountering something similar, the problem was not having USB connected during the initialization. Setting "connect_blocking" to false in USBSerial.h took care of it.)

I'm going to go ahead and assume that the only remaining issue (with using additional peripherals on the same bus) is also due to my ignorance and incompetence, and not an issue with the SPI_TFT_ILI9341 library.

My sincere apologies for opening my mouth before exhausting the investigation on my end.