STM32H750VB SPI Init Advanced Not Working

General discussion on mikroBasic PRO for ARM.
Post Reply
Author
Message
s_sergiu
Posts: 77
Joined: 10 Jan 2012 15:09

STM32H750VB SPI Init Advanced Not Working

#1 Post by s_sergiu » 03 Oct 2022 15:28

Hello,

I tested today a PCB with STM32H750VB connected to one MPU6000 board in SPI mode.
Using other compiler (Keil uVision) I can read and write the MPU6000 without problems.
However SPI Init Advance in mikroBasic is not working.
Reading the SPI2_CFG1 and SPI2_CFG2 in debug mode will show default (after reset) values.

RCC_APB1LENR.SPI2EN = 1
SPI2_Init_Advanced(_SPI_FPCLK_DIV256, _SPI_MASTER OR _SPI_8_BIT OR _SPI_CLK_IDLE_HIGH OR
_SPI_SECOND_CLK_EDGE_TRANSITION OR _SPI_MSB_FIRST OR _SPI_SS_DISABLE OR
_SPI_SSM_ENABLE OR _SPI_SSI_1, @_GPIO_MODULE_SPI2_PB13_14_15)
SPI_Set_Active(@SPI2_Read, @SPI2_Write)

to make work SPI_CLK_IDLE_HIGH I had to use CPOL_SPI2_CFG2_bit = 1. Same for Master mode.
Also _SPI_FPCLK_DIV256 (or other DIV values) will not change MBR[2:0] in SPI2_CFG1 from default 000.
The strange thing is that while MOSI signal looks nice square in oscilloscope between 0 to 3.3V, the CLK signal looks distorted and shifted between 2 to 3.3V.
I suppose that GPIO AF are not set up properly.

Any help is appreciated.
Sergiu

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: STM32H750VB SPI Init Advanced Not Working

#2 Post by filip » 12 Oct 2022 09:46

Hi,

Which version of the compiler are you using ?

Regards,
Filip.

s_sergiu
Posts: 77
Joined: 10 Jan 2012 15:09

Re: STM32H750VB SPI Init Advanced Not Working

#3 Post by s_sergiu » 12 Oct 2022 17:29

Hello Filip,

I use the latest version 6.2.0.
I tested all SPI ports from 1 to 6.
I also changed the mcu to H743ZI in project settings with same reasults.
I worked at registers level (according to stm32h750 reference manual) and I can send one bytes at a time on MOSI which looks good in oscilloscope but strugling with receiving part.
It will be great if the SPI library for H7 can be fixed.


Regards,
Sergiu

Post Reply

Return to “mikroBasic PRO for ARM General”