2024-02-08 12:32 PM
Hello,
i am trying to interface 1.8 inch SPI TFT Display 128 x 160 to the STM32F103C8 using SPI2.
https://www.az-delivery.de/products/1-8-zoll-spi-tft-display
SPI1 is used for LoRa, i thought to connect TFT too to SPI1 using addresses but i am affraid to influence the
LoRa.
The library which i am using is from this website:
https://controllerstech.com/st7735-1-8-tft-display-with-stm32/
A year earlier i tried to interface LoRa to STM32F103C8 using SPI2 but without success.
Is it a general problem in STM32F103C8 using SPI2?
Any help is appreciated.
Solved! Go to Solution.
2024-03-18 11:17 PM
The problem was with the hardware.
Finally i could get the SPI2 work together with SPI1 on the same Board.
Many Bluepills are just not good this days.
Anyway thank you all for being helpful.
Best regards
Mohamad
2024-02-08 12:34 PM - edited 2024-02-08 12:34 PM
@hamo wrote:Is it a general problem in STM32F103C8 using SPI2?
No - it shouldn't be.
2024-02-08 12:45 PM
Then what is the problem
Here is how i configured the stm32f103 usnig STM32CubeMX:
2024-02-08 12:49 PM
@hamo wrote:Then what is the problem
No idea!
All you've said is that you failed with it previously - we have no way to tell what you were doing wrong.
What debugging did you do? What did you discover?
2024-02-08 01:19 PM
Has someone had success with SPI2 interfacing anything to stm32?
I am using KEIL IDE, it freezes as soon as it reaches HAL_SPI_Transmit().
No idea why?
2024-02-08 01:33 PM
So, again, what debugging have you done to find why it's freezing?
Have you stepped into HAL_SPI_Transmit() to see what's happening ?
Have you looked at the SPI lines to see what's happening?
2024-02-08 10:06 PM
No, i stoped by HAL_SPI_Transmit(). It was late yesterday.
Today i am going to debug it correctly and i will post the results here.
My clock frequenz is max 72MHz and i looked at block diagram of blue pill and saw that SPI2 is on APB1 which has max 36MHz, so shall i change the cinfiguration in any way different than SPI1?
2024-02-09 12:58 AM - edited 2024-02-09 01:00 AM
@hamo wrote:i looked at block diagram of blue pill and saw that SPI2 is on APB1
"Blue Pill" is just a board; it doesn't affect the internals of the chip - that remains the same irrespective of what board it's mounted on!
You need to be looking at the chip documentation - Datasheet and Reference Manual.
https://www.st.com/en/microcontrollers-microprocessors/stm32f103c8.html#documentation
But, yes - getting the clock configurations correct is essential to everything!
You say you're using STM32CubeMX - the 'Clock Configuration' tab there will flag any clock setting issues ...
2024-02-11 06:02 AM
Hello,
i have debugged it and found out that when goes into hal_spi_transmit() it initilaize every thing correct and when it try to transmit the data it chosses to transmit data in 8 bit mode (which is correct) it waits till TXE flag is set to send data, but goes to time out which means that TXE flag is not set (i think).
It keeps stuck there. I have tried to change RESET, CS and DC pins but without success.
2024-02-12 03:18 AM
Read out and check/post content of SPI and relevant GPIO/AFIO registers.
Observe SPI pins. Do you see SCK toggling?
JW