2019-11-08 12:56 PM
HI Community,
I am working on developing applications on my STM32 IoT Discovery Kit. So far am able to compile examples/demos and they are working perfectly fine on STM32CubeIDE. However i want to setup my own project hereafter, I am facing lot of problems when i generate new STM32 project by targeting my board on CubeMX and working on generated codes.
Whats the correct way to start a new project on STM32CubeIDE ? All the example code refer different folder structure on x-cube-cld-gen libraries. Are we supposed to just build on example projects ?
2024-11-15 02:24 AM
@ambinabhi wrote:
- The code don't work exactly with CubeMX generated projects. I face problems in transmitting on UART or getting SPI interrupt for Wifi setup or some other way, but it works perfectly fine with example code
Then you need to debug your code to see what's going wrong.
When you have an example that does work, compare your code to that - see where they differ.
Use the debugger to step through the example code, then use the debugger to step through your code - see what's different.
@ambinabhi wrote:2. The example/template doesn't have .ioc file. Is that how they are supposed to be ?
Indeed - not all examples have .ioc files:
https://community.st.com/t5/stm32-mcus-products/some-example-projects-don-t-use-ioc-file/m-p/698330
@ambinabhi wrote:3. I even copied code from examples and put it my project(CubeMX generated), but somewhere the HAL files don't match and functionality breaks down although project compiles properly.
This is not specific to STM32CubeIDE or ST - when taking any code from one project to another, you're going to have to spend some time checking dependencies, etc.
This is just an everyday part of software development.
@ambinabhi wrote:Whats the correct way to start a new project on STM32CubeIDE ? All the example code refer different folder structure on x-cube-cld-gen libraries.
That's entirely up to you. STM32CubeIDE does not constrain you to any particular folder structure - use whatever works for you.
Of course, any time you bring in any 3rd-party code it will have its own internal structure - so you're always going to work out how to accommodate that in your own project
@ambinabhi wrote:Are we supposed to just build on example projects ?
That can certainly be a valid approach.
Starting from a working base can be a lot easier than trying to create a working base from scratch ...
2024-11-15 10:41 AM
> Are we supposed to just build on example projects ?
Short answer - yes. Developer or team with suitable experience and background will be able to get a working example (call it prototype) themselves, in a way that Andrew described (start from anything working, compare sources, debug).
For developer or team without experience the best option is to find a consultant -who will make a working prototype, set up the tools, find documentation and bring other goodies.
2024-11-15 07:36 PM
When generating code that you want to interrupt like for UART or SPI, you have to enable NVIC. You didn't mention that you have enable them. Attach your project so we can see if you've initialized peripherals correctly..