2014-09-18 09:08 AM
Hello Friends,
Can you please advise me on an issue (which is most likely to be due to an error I am making). Using STM32Cube version 4.3.1, I put together a project for a Cortex M4 that will use USART1 in asynchronous bidirectional mode. I am using IAR (not that that should matter but just in case). I am able to send strings of data out of UART using the HAL_UART_Transmit() function, no problems. However I want to obtain and process an interrupt every time a single character gets received by the UART. (I have my own input string handler.) To move in this direction, I added a line of code to USART1_IRQHandler() as follows: void USART1_IRQHandler(void) { HAL_NVIC_ClearPendingIRQ(USART1_IRQn); HAL_UART_IRQHandler(&huart1); cin = huart1.Instance->DR & 0x00FF; // this is a uint8_t declared elsewhere } I will eventually do something else. Well, that interrupt never gets generated when I send data to the processor. More telling though, when I try to set a breakpoint withint he USART1_IRQHandler() function, I am unable to do so. I can set a breakpoint in SysTick_Handler() so I know that file is being included. In the STM32Cube project under the Configuration tab, I did configure the USART1 so that USART1 global interrupt is enabled. The Preemption Priority and Sub Priority are both set to zero. When I click on the NVIC button, I see again that USART1 global interrupt is enabled. Thank You for reading this. GeofEdit: I modified the title of this thread to clarify it's contents. #stm32cube-working-now?2014-09-18 09:44 AM
Hi Geof,
It seems a duplicate [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32Cube%20%20UART%20Receive%20Interrupt&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=77]thread.Regards,Heisenberg2014-09-18 10:59 AM
Hello Heisenberg (and others),
Thank You for your fast reply! I did see and study that other thread you linked before posting the above. Let me put it another way- It appears that the USART1_IRQHandler function is somehow not linked. I looked at the .map file and could not find that function in the report. The .map file *did* include the SysTick_Handler function so I do know that the compiler took the stm32f4xxx_it.c file. I would have thought that STM32Cube would set up the project so that everything, including interrupt handlers, needed would be compiled/linked, but this seems not the case. Is there something silly I am missing? Thank You Kindly, Geof2014-09-18 04:17 PM
I would have thought that STM32Cube would set up the project so that everything, including interrupt handlers, needed would be compiled/linked, but this seems not the case. Is there something silly I am missing?
Well the evidence suggests Cube hasn't quite met/exceeded the Shakespeare-Monkey Criterion for automatic code generation yet. It's a bit odd it's in the .C but not in the .MAP, did it get into the .O file? Is there some date/time issue stopping it from incrementally building properly? Rebuild All? Perhaps you can objdump/fromelf a disassembly of STM32Fxxx_it.o2014-09-19 11:17 AM
Clive- Thank You for your response.
I tried two things: First, I contacted IAR and they suggested adding the __root keyword to the interrupt handler. When I did that, the USART1_IRQHandler *did* finally appear in the .map file as well as in the disassembly window and so was linked. However the interrupt was still not properly handled- when I sent a single byte to the UART, the program just went to an infinite loop in NMI_Handler. So something still is not right. ''Rebuild all'' did not help any. I'm not sure how to do an objdump but will look into it. If anyone from the Cube team can suggest anything else to try, I am all ears and will try to help out since I do like the premise of Cube.2014-09-22 05:09 AM
Not only must the interrupt handler be present in the executable, its start address must be at the right place in the vector table. This is usually achieved by giving the handler the same name as the appropriate symbol in the vector table. The latter is usually situated in the startup.S file, i.e. assembler code. The rest is managed by the linker.
Not sure how IAR manages it.I'm not sure how to do an objdump but will look into it. Using objdump, you can disassemble the built project, and check for the above mentioned circumstances. Can't cite the proper call flags by heart, but shouldn't be too difficult ...If anyone from the Cube team can suggest anything else to try, I am all ears and will try to help out since I do like the premise of Cube.After the first bug reports, and invoking several years of experience with ''first versions'' of development tools in general, I decided to shun Cube indefinitely. The standard peripherals libraries, albeit far from being perfect, are much more stable.
2015-01-19 03:10 AM
Hi all,
After discussion with our development team, it turned out that this implementation is not adequate as the interruption sub-routine is polling the status register during the 2 last characters period.We have already the limitation in the STM32Cube HAL bugs list, and it will be fixed in next releases of F4. Please continue submitting your valuable feedback.Regards,Heisenberg.2015-08-27 02:43 PM
Heisenberg, everyone,
I'm trying another go at 'Cube, using the most recent version available as of today (27 August 2015). I am still not able to generate a UART interrupt, e.g. the function USART1_IRQHandler() never gets called when I send data via UART. (The processor transmits UART just fine though.) This time, the USART1_IRQHandler function *is* in the .map file. But, alas, still no interrupt. Is it fair to say that STM32Cube is still not working, or is there still something I am missing? Thanks! Geof2015-08-28 07:55 AM
Hi barrows.geoffrey,
Did you turn the example under STM32Cube_FW_F4_V1.7.0\Projects\STM32F429I-Discovery\Examples\UART\UART_TwoBoards_ComIT? Have a look at it. -Shahrzad-2016-07-18 12:44 AM
I had the same problem.
Interrupt
handler neverjumped
. Solution: Use forUSART1_RX
PB7 pin instead of PA10. / * RX USART1PB7
* / #defineUSARTx_RX_PIN
GPIO_Pin_7 #defineUSARTx_RX_GPIO_PORT
GPIOB #define USARTx_RX_GPIO_CLKRCC_AHB1Periph_GPIOB
#define USARTx_RX_SOURCE GPIO_ PinSource7#define
USARTx_RX_AF
GPIO_AF_USART1 Analysis of the problem: I looked at the oscilloscope senyal receiving PA10 when myconverting
USB-USART sending data . The lowsignal level
was above 1/2 VCC. Actually, my STM32F429I was not gettinganything.
Therefore, the interrupt is not activated. Possible cause: the pin PA10 is prepared for USB communicationand has
different value of resistance Pull_Up and Pull_Down. Another possible solution: Try a different USB-USARTor amplify
TX
senyal
of our USB-USART to ensure that we get correctdigital values.