8 years, 10 months ago.

Problem with SPI0 and SPI1 (MyTouch library)

Hi mbed, I have a problem using a touch screen on a program.
I'm developing with the FRDM-KL25Z from Freescale and I connect to it an TFT display with SSD1289 lcd driver plus Touch sensor controlled by the XPT2046 touch controller.
I'm using this library for control the touch screen : - https://developer.mbed.org/users/micchassek/code/MyTouch/ -
I use it with success but not all the times.
with this definition of the object "touch":

MYTOUCH touch(PTD2,PTD3,PTD1,PTD0,PTD5,USE_12BITS,&mytouch_irq_handler);

the program works fine.
but if I use this(that the main difference is to use the SPI1 instead the SPI0):

MYTOUCH touch(PTD6,PTD7,PTD5,PTD4,PTB0,USE_12BITS,&mytouch_irq_handler);

the program doesn't works and this not mean that I can't only use the touch but all the program doesn't run.
anyone of you should know the issue? Thanks

I found the problem also isolating the touch screen code (so without display and only the red led for obtain a feedback from touch) and the program doesn't work.. It could be a problem of the SPI pin mapping? I see an old post that explain this issue but now it should be solved. Could anyone confirm me the problem with SPI1 on PTD7,PTD6,PTD5 pins? Thanks in advice

posted by Mattia Benato 18 May 2015

It seems that also SPI0 on PTC7,PTC6,PTC5 cause problem...anyone of you have already met this problem with SPI on FRDM-KL25Z?

posted by Mattia Benato 18 May 2015

They should be supported if I quickly check the mbed code. Did you check your mbed library is the latest version? This is a bit weird since the KL25 is one of the older mbed platforms, so I would have expected that such a large issue on several SPI pins would have been noticed before.

posted by Erik - 18 May 2015

Hi Erik, Yes, the mbed library is the latest,I update it some days ago when I restart to write some code.. It seems weird also for me,I see your own post about two years ago that talk about an issue on SPI pin mapping on FRDM KL25Z board. I think that after 2 years an important problem like this should be solved but I see that there are problems.. As soon as I can, I'll connect the XPT2046 on all SPI port that this board allow and report here which of these works and not works, however I would ask to people that work on this good project that mbed is, to control this issue because it seems very weird that I cannot use all the SPI pins.. Besides, if anyone is able to use the SPI pins that above I mentioned like "not working pins", please take part to this discussion Thanks

posted by Mattia Benato 18 May 2015

Yeah that issue was solved very long ago.

I will soonish in one of these days do a quick check with logic analyzer on my KL25 board to see if it works. Although it is mated to another board, which makes it harder for me to check it with a logic analyzer.

posted by Erik - 19 May 2015

1 Answer

8 years, 10 months ago.

Just verified with my logic analyzer: PTD7, 6, 5 SPI works fine for me.

Accepted Answer

Hi! I control all the SPI that you can use with the FRDM KL25Z board and they works fine! The mapping is correct and works fine! I solved the problem: the problem was on the interrupt of the touch IC,when you use this library it sets the irq pin like an InterruptIn and with FRDM KL25Z only PTAx and PTDx ports can be use with interrupt. Thanks for investigates this!! Bye

posted by Mattia Benato 22 May 2015