2017-06-04 08:24 PM
I need help please.
I have successfully built (using IAR) and run V4.3 FOC project on an STM32303E Eval board. I used the standard included project for this and after a few teething problems, I got it all to work.
The next step was to spin a custom board for my application. It is at this point I am having some issues. After re-configuring everything, it compiles fine and loads ok BUT when running the program, it seems to hang at some obscure memory location (see below).
I designed a custom PCB based off of NUCLEO-F303RE (which is supported by SDK). However, I'm using MCU STM32F303RB and have remapped most of the pins to appropriate and supported pins by the FOC SDK (see attached schematic). Other than the pins, the main difference is that I'm using an on-board 8MHz crystal as the clock source - I believe the Nucleo gets its clock source from the st-link part of the board. Do I need to reconfigure something in the library because of this?
Here is the process I took to get to where I am:
This compiled fine and uploaded but when running it always crashes and hangs. I'm not sure how it got to this location or what it is. An interrupt vector or ?:
To debug, I stepped through the program until it hanged and I traced the crash point to the ''MCboot(oMCI,oMCT);'' function in main.c. So I assume something in the initialization is breaking down. Further stepping revealed that it seems to crash at the point of enabling IRQ channel 0x18 which I believe is TIM8_BRK_IRQn. If I try to step any further through the C code, it'll hang at this point. If I step through the disassembled code, it seems to get through this function but will then still hang if I let it free run after this.
I'm not sure how to debug this issue so I first wanted to check if there is something I've done wrong with the configuration of the project. It feels like a timer/clock source issue. I've probed the crystal with a scope and I can see the 8Mhz waveform which looks stable enough so I'm not sure what it is and why it goes to that wierd memory location.
Any help would be appreciated.
#stm32f #foc-4.3Solved! Go to Solution.
2017-06-04 09:56 PM
OK. So after spending all that time preparing a detailed post.... I found the issue!!! Sigh.
Out of desperation, I tried to recompile using the STM32303C-EVAL_SINGLEDRIVE as this seemed to work for me initially. I changed the project configuration as required (eg. selecting correct device, making sure correct MC library is used etc). After compiling I loaded it into my hardware and BAM it worked!!
Strange - I set it up the same way as for the other F302 user project.
I started investigating. I looked at map files from both projects and noticed that the code was not exactly the same (as one would have expected). One of the functions compiled with a different size:
I investigated further and compared the project options, one by one. I noticed that one defined symbol was missing in the STM32F302_SINGLE_DRIVE project (eg. the one that was not working). ''CCMRAM'' was missing from the defined symbols list in project options. After adding this to the project that was crashing on me, it started to work. Comparing the map files now revealed exactly the same output from both projects.
Not sure exactly how not defining this symbol created the bad code so would love to hear someones though on this.
In short, this was an error in the SDK which probably should be rectified. Thanks ST .
2017-06-04 09:56 PM
OK. So after spending all that time preparing a detailed post.... I found the issue!!! Sigh.
Out of desperation, I tried to recompile using the STM32303C-EVAL_SINGLEDRIVE as this seemed to work for me initially. I changed the project configuration as required (eg. selecting correct device, making sure correct MC library is used etc). After compiling I loaded it into my hardware and BAM it worked!!
Strange - I set it up the same way as for the other F302 user project.
I started investigating. I looked at map files from both projects and noticed that the code was not exactly the same (as one would have expected). One of the functions compiled with a different size:
I investigated further and compared the project options, one by one. I noticed that one defined symbol was missing in the STM32F302_SINGLE_DRIVE project (eg. the one that was not working). ''CCMRAM'' was missing from the defined symbols list in project options. After adding this to the project that was crashing on me, it started to work. Comparing the map files now revealed exactly the same output from both projects.
Not sure exactly how not defining this symbol created the bad code so would love to hear someones though on this.
In short, this was an error in the SDK which probably should be rectified. Thanks ST .
2021-06-15 01:52 AM
The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 MC SDK).
Best regards