cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7A3ZIT6-Q - TIM_HandleTypeDef* being rewritten upon function call

JGree.10
Associate

Hi, I'm writing an application that is supposed to change the PWM pulse of Timer 17 based on ADC inputs (right now, instead of ADC inputs, I'm using simulated inputs). To do this, I wrote a struct, which among other things, stores the handler for Timer 17 when the program is started. For some reason, the address within the struct is being rewritten during a function call, which can be seen in the images below (line 39 to line 48).

0693W00000NrjgtQAB.png 

0693W00000NrjhNQAR.pngNo other variable is being rewritten within the struct, and whenever I run the program, it's always the same value being written (0x4d37 1b00). I looked through the memory mapping information in the MCU user manual (RM0455 page 133), and can't find any information about the address 0x4d371b00; and I can't figure out why this value would possibly be written to the timer handler member variable of the struct. Does anyone have any insight as to why a member variable would be rewritten on a function write?

Please let me know if more details are needed - I'm very new to this platform and embedded programming in general, so I apologize if I'm missing something obvious/not providing crucial details. Thanks!

UPDATE: Changing the timer to TIM16 yields the same problem; interestingly, the value of "htimPWM" is still being rewritten as 0x4d371b00.

UPDATE 2: It seems that the exact instruction on which this value is being written is "vpush {d8}", which from what I understand, pushes a floating point value onto the stack (the value of the d8 register being 0 when the program is running). Any clue as to why pushing an empty floating point value onto the stack would change the value of a totally different member variable?

0693W00000NrkSsQAJ.png

0 REPLIES 0