2024-07-14 01:38 AM - last edited on 2024-07-14 04:25 AM by STOne-32
Hii,
I am trying to interface ADC module cs5532 using SPI communication with STM32H563ZIT6 on NucleoH563zi board.
I have also completed pin configuration on .ioc file and successfully generated a code. But SPI communication is not initializing.
I have also tried with other controllers and it is working fine with their spi. The issue is only for STM32 i am facing.
2024-07-14 02:21 AM
Hi,
so after starting main - what you do with the spi ? (Nothing will happen on its own.)
>The issue is only for STM32 i am facing.
Whats the "issue" then , different to ...xx(which cpu ?) ?
>I have also tried with other controllers and it is working fine with their spi.
Which controllers and what you programmed there ?
2024-07-14 04:27 AM
Dear @digambar ,
Welcome in STCommunity! Can give more details in your configuration - Used pins /wiring ? And also code and environment to help you .
Ciao
STOne-32
2024-07-23 09:35 PM
Controller Used: STM32H563ZIT6 (Nucleo H563ZI)
Slave Used: CS5532
Communication Mode: SPI5
PF7: SCK, PF8: MISO, PF9: MOSI, PG1: CS, 5V, Gnd
SCK Speed: 2 MHz, SPIMode0, MSB bit first
The code is attached for your reference
The issue is not getting any data from CS5532 (it continuously giving FF as an output due to pullup.
2024-07-23 09:48 PM
Yeah I am facing this issue with STM32 only.
I have successfully interfaced CS5532 with ESP32
2024-07-26 04:03 AM
The updated code is attached for reference.
When I interfaced CS5532 with another microcontroller(ESP32), I got the output properly as shown in ESP32 (Expected) image (Second image).
Yellow line : MISO data
Blue Line: Clock 2MHZ
Pink line: MOSI data (0xC0)
But when I interfaced it with STM32 I didn't receive any signal.
The clock pulse is having set of 8 cycles (8 bit data). So while interfacing with STM32 the MOSI signal goes to high between two sets of clock pulses.
2024-07-26 05:08 AM
Dear @digambar ,
Can you check your VD+ pin voltage of the CS5532 Cirrus IC . To interface with STM32 SPI it should be at 3volts rail . If possible to have power schematics . As I see the one working ( second screen) the SPI clock for ESP32 is at 5 Volts.
Hope it helps .
STOne-32
2024-07-26 05:18 AM
I have also tried it with 3.3V, same issue occurred.
2024-07-26 05:45 AM
Thank you for the follow up. This is two last suggestions :
1) in the code I do not see SPI5 GPIO configuration: MOSI, MISO , SCK pins in Alternate functions or I overlooked the code .
There are only clock enable if 3 ports F,H and G and configuration of PG1 ( CS) in software and No PF7-9
2) try another SPI port for debugging purposes and using our reference code examples .
Hope it helps ,
STOne-32
2024-07-26 06:04 AM
These functions are included in stm32h5xx_hal_msp.c file which is generated by stm32cube.
I have also tried it with spi3 and spi1 and facing the same issue