2014-12-10 02:38 PM
Hi,
I am trying a simpleexperiment using my STM L1 Discovery board. I have created a project using the STMCubeMX GUI that has the SPI port enabled as Master. The clocks have been configured correctly and I have a GPIO port enabled as well. All I am trying to do is to repeatedly send data on the SPI port (SPI2) using the ''HAL_SPI_TransmitReceive'' function. When doing so I see no activity on the SPI CLOCK or MOSI pins of the board. The necessary SPI initialization function is indeed present (MX_SPI2_Init()). I can also toggle my GPIO pin successfully which shows that the system clock has been configured. I also removed the LCD from the board as indicated in the board datasheet to make sure that has been taken out of the picture. Any idea what might be going on here? I'm thinking it is some gotcha that I am running into. If anybody can point to sample SPI code for the L152RC part that would be helpful. I am most concerned about the port assignment. My understanding is that the cube routines should do this automatically (within the HAL_SPI_MspInit function), but I'd like to try a known example. Thanks, Ben2014-12-11 05:56 AM
You should find SPI examples in the
http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260821
package.Check them to know what is missed in your configuration using CubeMX.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-02-05 10:54 AM
I had a similar issue and after some frustration I got it to work. Here's what I did.
Go into Cube and in the configuration tab click on the SPI peripheral. Change the Prescaler for Baud Rate to 256. Then go to the GPIO setting tab and click on each of the pins and change their Maximum Output Speed to Fast. After that I finally saw a clock on the pin.