2021-04-22 06:58 AM
I've been developing my own peripheral drivers as a learning exercise, and upon writing the USART drivers, I came to an interesting problem. The interrupts were not being handled at all! Instead of calling the ISR routine, I was getting UsageFault errors...
Upon closer inspection of the startup file (auto generated by CubeIDE), it didn't have any USART handler symbols at all. Just 0's and marked as reserved.
I attach a screenshot of part of the vector table section of the startup_stm32f401ccux.s file:According to the RM for the F401xC chips (RM0368), for example, right after the SPI2 handler, should come the USART1 and USART2 handlers, not the "reserved" 0's...
I added these handlers myself to the vector table (at the appropriate places according to the vector table in section 10.2 of the RM) and now the driver code runs smoothly as it should, with the interrupts being handled properly...
Maybe it's a bug in the auto-generation of these files?
Solved! Go to Solution.
2021-05-20 05:09 AM
Hi!
Yes, it indeed looks like to be a very similar problem. As the person that posted on that linked, I also noticed that the startup file with the missing handlers is only generated when creating an "Empty project". If you go through the MX interface to generate the initial HAL related files and code, then the proper startup file is generated.
It's a bit annoying but easy to workaround, I just copy the "proper" startup file from one project to another after creation.
2021-04-22 11:35 AM
it is probably a bug.
i reproduced it. Inside the repository the startup file is ok
2021-04-23 12:48 AM
Does the header comment of the .s file mention the model?
2021-04-23 06:32 AM
Indeed, I looked through the repository and the sample files for the F401-Discovery board contain the startup file with all vectors populated.
Based on that and the vector table in RM0368 I completed the auto-generated file table, and it's attached here for reference (with extension changed to .cpp so the system allows upload...).
2021-04-27 07:07 AM
Hi @RMaia ,
This seems to be a similar issue as the one reported here.
This limitation is tracked internally in order to provide a fix.
Sorry for such inconvenience.
-Amel
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.
2021-05-20 05:09 AM
Hi!
Yes, it indeed looks like to be a very similar problem. As the person that posted on that linked, I also noticed that the startup file with the missing handlers is only generated when creating an "Empty project". If you go through the MX interface to generate the initial HAL related files and code, then the proper startup file is generated.
It's a bit annoying but easy to workaround, I just copy the "proper" startup file from one project to another after creation.
2021-06-09 02:23 AM
Confirmed bug in Empty project startup file template. Let's see if we can address in the next release.
Internal ticket reference: 108658.
2021-07-02 04:15 AM
Hi RMaia,
Indeed the USART handlers (interrupts) were missing in the SVD file declaration.
I am sharing with our latest SVD for stm32F401 that should be integrated in upcoming release for CubeIDE.
All you need is to replace old file with new one under IDE path.
Don't hesitate if you have more feedbacks to share!
Regards,
-Imen