I thought they removed support for that st link v2 knock off
Possible. Iām still using Arduino IDE 1.8 and STM32CubeProgrammer 2.11, so maybe the latest versions donāt work as well.
I normally program with 3.3v from the ST-Link connected directly to the driver boardās 3.3v net (bypassing the onboard 3.3v regulator), then unplug it and plug in the battery. But I have forgotten to unplug the battery before connecting the ST-Link and nothing bad happened, so itās not instant death if the onboard 3.3v regulator and ST-Linkās 3.3v supply try to power it at the same time.
Uploading via Arduino IDE is quicker when everything is working well, but STM32CubeProgrammer is better if youāre having problems since you donāt have to wait for the program to recompile before each upload attempt.
Iāll try to power it through st-link 3v3 and check
REGIN and REG 3v3 are not tied together, REGIN is connected to VCC at 8v is it safe to power on through 3v3 to VDD? And also how important is the boot 0 pin, is it mandatory to pull it to ground to boot in flash mode , and should the NRST pin have a 100k resistor or a 10k ohm pull up resistor to work correctly
Hmm, maybe not. Checking the datasheet, figure 12 in section 5.1.2 looks like VDD and REGIN have to be tied together to use externally-supplied 3.3v. I guess youāll have to power up the whole thing and only connect SWDIO,SWCLK,GND to the programmer.
NRST has an internal pull-up, so it should be fine floating. STM recommends a 100nF capacitor to ground to reduce the chance of accidental triggering, but itās not required. A stronger pull-up (like 10k or less) works too.
BOOT0 is also fine floating. Section 9.3.1 and 9.3.15 of RM0440 only say that itās in input mode at startup, not that it has an internal pull-down, but Iāve never had any trouble with it.
Ok, well right now all the other things check out, continuity, voltages, NRST, grounding etc , the boot 0 pin it seems is a like a mode selector, if pulled down - flash mode, if not itās in bootloader mode, like you said, at the moment that is the only thing I can think of as going wrong Iāll try to correct that and get back
Iāll also try changing the nrst pull up to 10k and see if it works
My board just connected for the first time yesterday it turned out to be just the nrst pull up resistor, now on to the next challenge, whatās the best way to program this board to run bldc motor in position control mode with current control, stm32 cube ide, vs code, stm32 mcsdk? Has anyone already done it
I havenāt used STSpin, but the datasheet says the integrated CPU is STM32G431VBx3 so you should be able to use the Generic G431VBTx board definition in Arduino IDE. It should use BLDCDriver6PWM, but Iām not sure what pins to give it. I canāt find any documentation for the hardware registers of STSpin, so I donāt know if the gates are repurposed GPIO pins or if they have special control registers or if theyāre hardwired to output the TIM1 signals and donāt need control registers.
Usually PA8,9,10 are TIM1_CH1,2,3 so I was guessing STSpin32G4 would have them renamed as GHS1,2,3, but since PA8,9,10 are also available then the gate pins are different.
Looking though other potential candidates, PE9 is the only pin that can do TIM1_CH1 and isnāt present on STSpin, and other PE pins have TIM1 channels, so I would try BLDCDriver6PWM(PE8, PE9, PE10, PE11, PE12, PE13); and probe the motor wire pads with a multimeter. If lower PWM duty outputs higher voltage, then swap each pair of pins. Thereās a chance it could explode if some of them are right and others are wrong, but if the gate pins are hardwired to output TIM1 then all you actually need to do is set up the TIM1 control registers, which is guaranteed to be done using those PE pins.
If you have the current sense resistors wired up the same way as evlspin32g4-act, youāll probably need to do some custom configuration of the opamps. You can look in the B-G431B-ESC1 code for an example, but I find the HAL code incomprehensible and would just read about them in reference manual RM0440 and use the register defines in \packages\STMicroelectronics\hardware\stm32\2.3.0\system\Drivers\CMSIS\Device\ST\STM32G4xx\Include\stm32g431xx.h to do it. Set them up to output on PA2,PA6,PB1 and pass those pins to the LowsideCurrentSense class.
If you want to use Arduino and SimpleFOC you should use the driver we have for it: Arduino-FOC-drivers/src/drivers/stspin32g4 at master Ā· simplefoc/Arduino-FOC-drivers Ā· GitHub
Since the pins are fixed you donāt have to bother with any of that if you use the dedicated driverā¦
Hereās a (somewhat old) platformio project using it on a custom board: GitHub - runger1101001/simplefoc_funqi_stack_firmware
Ya I find it very hard to understand the HAL of stm32 cube, ok so in arduino ide, use that driver to flash the firmware with 6pwm mode for the fixed predefined pins for pwm, I²C3, wake , fault, ready etc also I am using an external crystal 24mhz should I integrate that or can I just use the internal clock, and I am using the as5600 magnetic encoder on I²C1, so in main.c if I only define this and set it to position control it should work, atleast in voltage control mode, right? By the way, I run the blink test and it is working. I couldnāt reply from my original account because it told me I could reply only three times with the temporary membership