cancel
Showing results for 
Search instead for 
Did you mean: 

SFDC test question

CTest.1
Associate
<code><p>Hi everyone.</p><p> </p><p>So my previous post just did not load for some reason.</p><p>The problem is that for some reason I get this issue when I debug once I enable the interrupts.</p><p>I am simply trying to respond on the TIM5 interrupt but I get thrown to a part of the file startup_stmf32f401retx.s to this line of code:</p><p> </p><code>/** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval : None */ .section .text.Default_Handler,&quot;ax&quot;,%progbits Default_Handler: Infinite_Loop: b Infinite_Loop </code><p><code>Now it seems like it&#39;s suppose to help me analyse whats going on inside an interrupt but I didn&#39;t have any breakpoints set in the project yet?</code></p><code></code><p><code> </code></p><code></code><p><code>This is the Stack Trace.</code></p><code><code>Thread #1 [main] 1 [core: 0] (Suspended : Signal : SIGTRAP:Trace/breakpoint trap) UsageFault_Handler() at startup_stm32f401retx.s:101 0x8000630 () at 0xfffffff1 0x0 () at 0xfffffff9 stepper_init() at stepperpwm.c:18 0x80001ea main() at main.c:38 0x8000530 Reset_Handler() at startup_stm32f401retx.s:83 0x8000616 </code></code><p><code>Finally here is my code... I like to try it baremetal before I start using MCU specific headers for the most part.</code></p><code></code><p><code> </code></p><code><code>main () { housekeeping_init();   while(){ housekeeping(); } }     void housekeeping_init(){ __disable_irq();   RCC-&gt;AHB1ENR |= 1;//(1 &lt;&lt; 0);   //TIM5 RCC-&gt;APB1ENR |= (1 &lt;&lt; 3);   TIM5-&gt;PSC = 1000-1; TIM5-&gt;ARR = 10-1;   TIM5-&gt;DIER |= 1;   NVIC_SetPriority(TIM5_IRQn,2); NVIC_EnableIRQ(TIM5_IRQn); GPIOA-&gt;MODER |= 1; __enable_irq(); TIM5-&gt;CR1 |= 1; }   void TIM5_IRQHandler(){ //TIM5-&gt;SR &amp;= ~(1); TIM5-&gt;SR &amp;= ~0x01; //TIM5-&gt;SR = 0; GPIOA-&gt;ODR ^= 1; ***++; }   void housekeeping(){ if (*** == 300) { GPIOA-&gt;ODR ^= 1; } }</code></code><p><code> </code></p><code></code></code>

0 REPLIES 0