cancel
Showing results for 
Search instead for 
Did you mean: 

SPI1 with HAL works SPI2 with HAL does not work

Weightwatcherphil
Associate II

i used stm32cubeMX 6.12.1

and stm32cubeIDE 1.16.1

then I told cube to select the Nucleo u5a5zJ board

i configured the clocks and turned on SPI1 and accepted the default pins

i configured the GPDMA to use channels 7 and 6 

Next I generated code. i used the user code from the u575 SPI FULL DUPLEX_DMA master

but only the user code. i assume that the system would provide the proper drivers , etc for the 

u5A5 BOARD.

i compiled the code with stm32cubeIDE and it ran.  i did not connect and SPI chips I just let the code transmit the string and i put a breakpoint in main around line 161 at the compare functions.

the code hit the break point indicating the transmission completed and i saw SPI clocks on my scope on pin PA5.. 

called this project phil_u5a5_spi1 and it is attached.

then i repeated the same procedure for SPI2 

i accept the default pins except for SPI MOSI i changed PC3 to PC1.

i made PB10 pull down

PC1,PD3 pull up.

this code did not compile.  i had to go in and change the SP1 references to SP2

i had to go in change hspi1 instance to hspi2.

then it compiled and it got through the transmit and receive function but it did not work

correctly. there were NO SPI_clks on pin PB10.

the code did not reach the compare buffer instruction on line 161

i attached this project as phil_u5a5_SPI2.

 

i used winmerge to compare the projects and i do not see anything that i wrong.

so i am very puzzled and would very much appreciate you comments on what i might have done wrong.

i am under the impression that the simple user code for running the spi example should work fine on either board.

i have been trying to figure this out for weeks .

thank you very much!  

0 REPLIES 0