2025-10-27 3:17 AM
Hi all,
I'm in the process of configuring my STM32H723ZG to work with the IHM08M1 motor driver shield.
Currently I am trying to configure and validate the signals from the ADCs however I am having some issues with this. One ADC I'm trying to validate is the DC voltage bus reading. This circuit simply places the input through a voltage divider with some protection, going straight to the ADC after. I've tried configuring these ADCs in a few different ways, single channel, DMA, etc. however none of them produce the expected results.
What I'm currently seeing is that with the stm and shield disconnected, I can read the correct stepped down voltage on the shield side by probing with a multimeter (~0.5V depending on input voltage). When the stm is disconnected to the shield the ADC reads a floating ~1.64 volts. With the two connected the ADC seems to still be reading 'garbage' values, probing with a multimeter reads ~1.75 volts. The last bit of information I have is that by grabbing on to the ADC pin directly I am able to drive the signal to either 0V with ground or 3V3 with the stm's voltage source, and successfully read this in code.
I am relatively new to STM's so i appreciate you taking the time and effort to help me, any and all feedback is welcome.
Thanks
2025-10-30 11:01 PM - edited 2025-10-30 11:08 PM
Hi all I'm going to reply to myself and provide an update as I've made a bit more progress.
No progress made so far on the current sensing ADCs but I shifted focus to the BEMF ADCs. I disconnected R60, R62 and R63 from the driver shield and now they all seem to exhibit some behaviour when I spin the motor by hand. I believe currently two of them are correct, PC4 and PC5, after all conversion they read ~0.66V which is what I verified as correct with the multimeter when the motor is not moving, however, PC3 reads ~0.06V at this time. Also when I turn my power supply on the PC3 value changes like the others do but is static and won't change as I spin the motor by hand.
It's worth noting the differences in setup between PC4, PC5 and PC3. PC4 and PC4 are on ADC2, configured as 14bits with a 2 bit left bit shift. PC3 is configured on ADC3 which has max resolution of 12bits. I selected for it to have a 4 bit left shift so I could do the same conversion as the others however applying any left bit shift I noticed doesn't change the raw ADC value.
One other thing I'd like to ask about is the correct way to configure for positive and negative values. I hadn't yet considered the fact that both voltage and phase currents will be positive/negative. If anyone could provide insight to what changes need to be made in ADC setup or in post processing that would be great.
Thanks again for the help,
Evan
2025-11-03 12:52 AM
2025-11-03 1:14 AM
Hello @evanpol,
Did you verify the ADC input signals using an oscilloscope?
2025-11-03 1:37 AM
1. try no shift on adc3 , check the values...changing ?
2. check what pins are used: here !
PhA - PA3
PhB - PC2
PhC - PF10
BusV - PC0
+ verify this.
2025-11-05 2:02 AM
Thank you for your feedback, I'll have time to test these things tomorrow, firstly looking at the signals on an oscilloscope.
In response to @AScha.3's comments my entry for bitshift (no shift, 2 bits, 4 bits) on adc3 doesn't seem to change the output at all which is what confused me quite a bit.
As for the used pins, I have bemf_A (PC3), bemf_B (PC4), bemf_C (PC5), and BusV (PA1). These are different to the pins you mentioned but I am relatively confident they are correct and have verified that the correct physical pin on the shield corresponds to an output.
If possible could you guys provide any insight into the issue I might be having with the current sensing ADCs (maybe they need to be configured a certain way?) or my brief comment above regarding how to manage voltages and currents being a positive or negative value, with respect to how I should be setting up the code and the variables used.
Thank you so much for your help! I really appreciate it
2025-11-05 4:42 AM
>I am relatively confident they are correct
Just compare pin for pin position on the IHM08M1 to the connected pins on STM32H723Z-nucleo , then you KNOW:
PhA - PA3
PhB - PC2
PhC - PF10
BusV - PC0
+ verify this.
2025-11-06 3:52 AM
Made some more progress today,
I've moved on from trying to configure adc3 with the bitshift. I've scaled them all differently and applied an offset value to line up 0 with the floating disconnected value. I'm not sure if this is the correct approach as you can see in the BEMF converted figure, what I believe is a phase-neutral measurement now has some negative value because of the offset, I'm not sure if this is acceptable or not.
@GMA mentioned validating the measurements with a scope. I noticed that when I spun the motor with a hand drill, the ADC pin would measure (with an oscilloscope) a 0.4V p-p reading whereas in software it would be ~1V, I'm not sure if my conversion is wrong, I am just doing a simple voltage divider calculation between R39 and R36.
Additionally, I had a question about converting the current sensing adcs, I was able to get the following data in the currents, A, B, C figure but am unsure of how to convert this into meaningful data.
Lastly, I had a question regarding the timing of the logic for my control loop. I want to configure to main loops, one for current control and 1 for speed control, with theouter current loop ~10x faster, i.e. current loop 10kHz, speed loop 1kHz. My initial idea was to create a timer interrupt that calls the relevant functions at these fixed frequencies but I'm not sure if it's appropriate to have that level of computation in the ISR, I don't believe the stm is capable of handling that without blocking. If anyone has ideas of a cleaner/better way to get this desired behaviour I'd greatly appreciate it.
Once again thank you for your help, I really appreciate it.
2025-11-10 3:14 AM
2025-11-10 5:01 AM
Hi,
now the signals look plausible.
On which pins you read now ?