cancel
Showing results for 
Search instead for 
Did you mean: 

Custom STSPIN32 Board flashing not working

kenni
Associate II

Hello STM Community,

We are developing a custom motor driver board based on the STSPIN32F0251 and are encountering challenges with consistently flashing firmware onto the device. Below, I’ve shared our schematic (STSPIN schematic on page 3) and the steps we’ve taken so far, along with the issues we’re facing. Any guidance or suggestions would be greatly appreciated.

Board Modifications

The following modifications were made to the PCB:

  1. Grounded the RES5 pin using a flywire.

  2. Corrected the V+ and V- connections on U2 by lifting the pins on the package and flywiring them to the appropriate nets.

Flashing Process

We used an STLink on a NUCLEO-LR476RG to flash the motor control code attached as a zip file in this post. Here’s the step-by-step process we followed:

  1. Set S1 on the board to the UP position (tying BOOT0 high to boot from flash memory) and reset the STSPIN using the RESET button.

  2. Open STM32CubeProgrammer, uncheck the “Debug in low power mode” option and click CONNECT.

  3. Verify communication between the STSPIN and the computer. This was confirmed by powering the board and connecting via STM32CubeProgrammer. The software recognized the MCU (displaying STM32F03#), and communication failed when the board was unpowered.

  4. Once connected, perform a Full chip erase using the option in the right-hand window.

  5. Select the file path for the program to flash, ensure the three checkboxes are selected (as shown in the image), and click Start Programming.

  6. If a “Data mismatch” error occurs, uncheck the “Skip flash erase before programming” option and retry Start Programming. Repeat until the process completes successfully.

  7. If other errors arise, disconnect and reconnect to the STM32, then repeat the steps.

  8. After a successful flash, set S1 back to the DOWN position (tying BOOT0 low) and reset the STSPIN using the RESET button.

Current Issues

While this process is the most consistent we’ve achieved so far, it is still far from reliable. Errors frequently interrupt the flashing process. Furthermore, flashing only works through STMprogrammer but not Cube, which means we can't use the debugger to debug. This is perplexing as Cube simply uses STMprogramer to flash. 

We also attempted to flash a motor control code generated by the Motor Control Workbench, which worked flawlessly on the EVSPIN32F0251S1 evaluation board but failed to operate on our custom PCB, despite the schematic being identical with few differences that were modded to be the same as described below.
On our custom PCB, we're observing the HVG1 pin is pulled high to 12V (VCC we fed) and other gate drive pins are low. This assertion on the gate is observed at the output phase U as well, as we see 12V at the input to the BLDC motor. 

Questions

  1. Are there any additional steps or checks we should consider to improve the consistency of the flashing process?

  2. What could explain the discrepancy in behaviour between the evaluation board and our custom PCB, given the identical schematic?

  3. What can we do/check to ensure the motor spinning in both firmware and hardware sense (ie: checking the state variable, faults, etc)
  4. Are there any known issues or best practices specific to the STSPIN32F0251 that we might be overlooking?

Any insights or suggestions would be immensely helpful. Thank you in advance for your support!

0 REPLIES 0