Difficulty debugging ISR issue.

I am using the MCBSTM32 evaluation board. I started with the "blinky" project.

I wanted to change it so that I could DMA a block of data from the ADC to memory. OK, I did that and it worked fine.

Next, I wanted to get an interrupt when the specified number of transfers had happened. I modified DMA1_Channel1_IRQHandler in stm32f10x_it.c to toggle a LED and set a flag when it happens. I also set the TCIE bit in DMA_CCR1

Being unfamiliar with the interrupt handler for this processor I looked at the code in STM32_Init.c for inspiration. In there I found that the initialization routines used the following:

 NVIC->Enable[n] |= (1 << ( <Position > & 0x1F));


Where n is the 32 bit array element where the bit is in and Position represents the bit position in that element.

With that in mind, and finding no initilization for DMA interrupt, I implemented the following in my code immediately after I enable the DMA chanel:

NVIC->Enable[0] |= (1 << (DMAChannel1_IRQChannel & 0x1F));


Where DMAChannel1_IRQChannel is 0x0B and being the position is less than 32, it should go into the first array element.

Needless to say it does not work. I put a break point on the interrupt and it never breaks. It seems to fault, but gets to an area of code I do not recognise. It is in STM32f10x.s and is the point highlighted in the following:


<snip>

EXTI15_10_IRQHandler
RTCAlarm_IRQHandler
USBWakeUp_IRQHandler

                B       . 

                ENDP


                ALIGN


; User Initial Stack & Heap

                IF      :DEF:__MICROLIB

<snip>

Any help or pointers would be appreciated.

Parents Reply Children
More questions in this forum