Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


STM32F1 SPI Simpleton Implementation Fail

France

Hi Ben,

First of all you should check that in your project settings at “project >> C/C++ Build >> Settings >> Tool Settings >> MCU GCC Compiler >> Warnings” the “All Warnings (-Wall)” option is checked. This will gives you warnings on potential errors you may have in your code.

Second, there is indeed several problems in your code:

  1. You do not need any parentheses in (pData) = ; you can write it simply as pData =
  2. pData, as its name implies, should be a pointer to uint8_t data (bytes);
    1. You should declare it as uint8_t *pData;
    2. Then you cannot assign it a byte, you must assign it the address of a byte, by pData = &TheDataItself;
    3. Finally you can pass to HAL_SPI_Transmit either pData or &TheDataItself, both will request HAL to transmit 1 byte of data (value of cnt), located in the TheDataItself variable
Probably the cleaner way to transmit a byte on the SPI would be to write:
uint8_t TheDataItself = 0xFF;
HAL_SPI_Transmit(&hspi2, &TheDataItself, sizeof(TheDataItself), 10); // 10 is the time out value.

Finally, I think you should read one of the numerous C programming courses you can find on the web: whatever it may look like, C is not a simple programming language, especially when going to pointers, and you need some guidance when starting to program in C.

Hope this helps clarifying things,

Bernard (Ac6)