2013-04-09 10:01 AM
2013-04-09 11:22 AM
Yeah, sounds like you're ending up in the Hard Fault routine. You might want to add a real handler there to ascertain why it's faulting.
You should really set up the NVIC side before enabling the interrupts. Your range checking for the buffers is broken. Tip: operator precedence If you're using C++, make sure that the vector table is actually pointing to your USARTx_IRQHandler() functions, and not dumping the processor into the while(1) tied to the unhandled interrupts. Check the function names in the .MAP file. Check the address for the routines in the vector table from within the debugger.2013-04-10 05:25 AM
I understand most of that. I forgot to mention this is my first ARM board. I'm coming from the 8 bit AVR world where you usually don't deal with startup files and such. Are there any good tutorials anyone knows of on startup files? I'm having trouble finding one. I know the startup file mentions that it maps the default interrupt handler to all interrupt routines with the .weak option, but that another definition should override that. Maybe not? Also, I'm trying to figure out how to use GDB to check if my vectors are mapped correctly. I've used GDB before, but not for embedded targets. I usually use it to track down segfaults in C++ programs for the x86. I'll post on my progress when I make some
2013-04-10 09:48 AM
Sure, there is the whole CMSIS documentation. But what is really important is the startup files for your particular part or family of parts. The startup is part specific. These should be in include files and lib files somewhere in your project.
2013-04-10 10:46 AM
Looking through the map file, the USART6_IRQHandler function is generated, but is not loaded into the vector table. In the startup file,
there are a bunch of lines which say .weak XXX_IRQHandler.thumb_set XXX_IRQHandler, Default_Handler
If I leave these alone, the USART3 and 6 handlers get mapped to the default handler. If I comment out the .thumb_set line, I don't see the USART interrupt handlers inserted anywhere in the vector table. Its almost like the linker isn't paying attention to my functions and placing them in the interrupt table.
2013-04-18 05:23 PM
Took me a lot of looking, but I finally found the problem. I must have accidentally started a new c++ project when I made the project. My main file was named main.cpp instead of main, so the linker was just grabbing the default handler instead. I noticed this when I moved some of my own code to a separate C file and the linker couldn't figure it out. Thanks for the tips