Johannes in a Blue Pill

User avatar
johu
Site Admin
Posts: 6735
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 378 times
Been thanked: 1559 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

Well, it would seem the Blue Pill has a little layout problem. So no matter if you set the break input active high or low it trips out as soon as the PWM runs, even though the break input is tied to ground or VCC, respectively. If the break function is disabled per timer register, all runs ok.
Now, I disabled the PWM1N output which is adjacent to the break input. Et voila: no trip.
Next I tried to enable the internal pull-up of break input and this also leads to avoiding false trips. Now the pin can even be left floating and as soon as it's pulled to GND the PWM stops.
When scoping the open pin you can see some cross talk but only about 150mV peak-to-peak and far away from the low threshold voltage. So still not 100% sure where the cross talk happens.

EDIT: binary attached
Attachments
stm32_sine.zip
(62.82 KiB) Downloaded 397 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Jack Bauer
Posts: 3663
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 11 times
Been thanked: 345 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

Cool. Will test this asap.
I'm going to need a hacksaw
User avatar
Bigpie
Posts: 1774
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 82 times
Been thanked: 424 times

Re: Johannes in a Blue Pill

Post by Bigpie »

It may be me doing something wrong, but I've flashed the above to bluepill, I've got GND and 3.3V connected as well as UART. Scope probe on PB_13 and issued start 2 (inverter started), set fslipspnt 10 (set OK), set ampnom 10 (set OK) and I don't get any output on PB_13
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
FOCCCI CCS
User avatar
Jack Bauer
Posts: 3663
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 11 times
Been thanked: 345 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

@bigpie You need a direction selected.

solved the encoder noise issue and we are now running an induction motor in closed loop mode with bluepill and prius inverter.
I'm going to need a hacksaw
User avatar
Bigpie
Posts: 1774
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 82 times
Been thanked: 424 times

Re: Johannes in a Blue Pill

Post by Bigpie »

@Jack Bauer :D I've got PWM now.

What's the bare minimum needed to start in mode 1? I don't want to bother with voltage, current and temperature sensors at the moment.
I want to next move on to running my 3D printed motor without position feedback.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
FOCCCI CCS
yaroslav
Posts: 176
Joined: Tue Aug 13, 2019 4:32 pm
Location: Russia, Stavropol
Has thanked: 14 times
Been thanked: 5 times

Re: Johannes in a Blue Pill

Post by yaroslav »

Good day, I do not see the brake signal, I checked the circuit and the resistance of 4.7 K and 1.2 K, but when applying + on PB9 nothing happens, in the web interface the brake signal is 0
User avatar
johu
Site Admin
Posts: 6735
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 378 times
Been thanked: 1559 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

So pull high PB1 and PB7 and momentarily, PB6.
Confirmed, theres a problem with PB9.
EDIT: found it, it was remainders of the user_pwm output on PB9. Will update on github.

So I had another idea. I could delete the uaux/mprot min and instead use it as exciter/tim_ch3 pin. The latter would enable the usage of hall sensors.

Is monitoring the "12V" voltage a commonly used feature? Personally I do check it from time to time.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
yaroslav
Posts: 176
Joined: Tue Aug 13, 2019 4:32 pm
Location: Russia, Stavropol
Has thanked: 14 times
Been thanked: 5 times

Re: Johannes in a Blue Pill

Post by yaroslav »

I do not use mprot at all because in my projects it is not present, and here 12V it is possible and to leave, for control
yaroslav
Posts: 176
Joined: Tue Aug 13, 2019 4:32 pm
Location: Russia, Stavropol
Has thanked: 14 times
Been thanked: 5 times

Re: Johannes in a Blue Pill

Post by yaroslav »

Still there was one problem, sometimes at a certain position of the encoder the engine without load starts with a delay, when the encoder is slightly cranked the problem goes away
yaroslav
Posts: 176
Joined: Tue Aug 13, 2019 4:32 pm
Location: Russia, Stavropol
Has thanked: 14 times
Been thanked: 5 times

Re: Johannes in a Blue Pill

Post by yaroslav »

I do not know what the problem is but it started with the installation of firmware 4.55 and higher, no matter what frequency I put fmax does not work the engine speed limit turns without load up to 12000rpm goes to accelerate
User avatar
konstantin8818
Posts: 290
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Has thanked: 2 times
Been thanked: 9 times

Re: Johannes in a Blue Pill

Post by konstantin8818 »

Trying to programm blue pill on a gen2 board with attached contactors, I've bumped into a problem. Every time I connect 12V to a board, precharge contactor cycles "on/off" three times and one time "on" in one second. I believe it cycles every time controller faces an error. There are three errors show up:
20200515_190302.jpg
And if I connect "start" to 12V, precharge contactor turns off as intended, but main does not turns on.
Am I the only one to face such a problem? Have I done something wrong?
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

I'm new to this forum, to this inverter and to STM32/ESP8266...
Trying to use a "blue pill" and an Olimex Mod-wifi-esp8266 to do some testing.
I have programmed the ESP with arduino ide and can axcess the web interface ok.
It sends out serial data when I use the "send custom command". Basically the ascii code of what I put in to send.
I have also programmed the STM32 with the lates firmware (stm32_sine.bin (4.85)) using stm32flash but I can not get any response from it in the web interface or any PWM output.
I have tried to pull PB1, PB7 and momentarly PB6 high but no PWM.
Also tried sending "start 2", then "set fslipspnt 10" and finally "set ampnom 10". Also with the above pins high.
I do not get any response in web interface when sending the commands? Are there suppose to be any response message?
I have tried reversing the rx/tx pins from the esp with no change.

What have I missed?
User avatar
johu
Site Admin
Posts: 6735
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 378 times
Been thanked: 1559 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

Are you on correct UART? PB10, PB11.
Yes there is always a response to valid commands.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

Yes, uart3.
If I flash the bootloader the stm32 sends 0x2D, as expected.
The firmware does not require the bootloader, correct? The firmware can be flashed directly on the blue pill bootloader?

I will create some simple arduino sketch to verify that the uart3 is working correctly and post when done.
User avatar
johu
Site Admin
Posts: 6735
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 378 times
Been thanked: 1559 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

It does require the boot loader. It is started at reset and starts the actual firmware when no update is requested.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

Ok, thanks, that explains alot!
I've just tested the hardware and it works.

Please, can you tell me how I upload first the bootloader and then the firmware, without erasing the bootloader, using stm32flash.
I guess -s option is needed but at what adress?
User avatar
johu
Site Admin
Posts: 6735
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 378 times
Been thanked: 1559 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

It's 11 years ago that I used stm32flash :) Boot loader is on 0x08000000 and firmware at 0x08001000
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

Hm, I've made some progress, I think.
Did:
stm32flash -w stm32_loader.hex -b 115200 /dev/ttyUSB0
stm32flash -w stm32_sine.hex -e 0 -b 115200 /dev/ttyUSB0
Now the onboard green led blinks!

Update:
It works!

Thank you for all your help!!
aravinth
Posts: 14
Joined: Sun Sep 13, 2020 8:34 am
Been thanked: 1 time

Re: Johannes in a Blue Pill

Post by aravinth »

I have flashed my Bluepill with a USB Bootloader and when I flash it with stm32_sine.bin the green led stays on.
Where do I find the bootloader which supports stm32_sine firmware ??
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

aravinth
Posts: 14
Joined: Sun Sep 13, 2020 8:34 am
Been thanked: 1 time

Re: Johannes in a Blue Pill

Post by aravinth »

Hello, I've got response from the bluepill.
My Current setup is Bluepill connected with USB to TTL Convertor, I used Putty on linux ubuntu for serial terminal.
I cant seem to start inverter in manual mode, typing start 2 on the terminal gives response as Inverter started, set fslipspnt 10 , set ampnom 10 and response is Set ok, and when I try to select the direction as set dir 1 it says value out of range, so I couldn't see any pwm pulses on any pwm pins.

Someone please tell me how to select the direction.
Thank you.
Isaac96
Posts: 656
Joined: Sat Oct 05, 2019 6:50 pm
Location: Northern California, USA
Been thanked: 2 times
Contact:

Re: Johannes in a Blue Pill

Post by Isaac96 »

Pull the FWD pin to positive (3.3v).
Not sure which pin that is, check the schematics.
User avatar
Bigpie
Posts: 1774
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 82 times
Been thanked: 424 times

Re: Johannes in a Blue Pill

Post by Bigpie »

Usart seems funky on my bluepills. Not sure why, if I use USB TTL the communication works, using Olimex mod wifi or demos d1 the communication doesn't work.

Anyone any idea why? These cheap bluepills seem very hit and miss.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
FOCCCI CCS
User avatar
bexander
Posts: 866
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 71 times
Been thanked: 97 times

Re: Johannes in a Blue Pill

Post by bexander »

Bigpie wrote: Sat Oct 31, 2020 4:38 pm Usart seems funky on my bluepills. Not sure why, if I use USB TTL the communication works, using Olimex mod wifi or demos d1 the communication doesn't work.

Anyone any idea why? These cheap bluepills seem very hit and miss.
What do you mean with seial communication doesn't work with WiFi-module. Please be more specific, is there no transmissions, signals are there but can't receive anything etc.
Have you tried to reverse postion of Tx and Rx when using the WiFi-modules?
User avatar
Bigpie
Posts: 1774
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 82 times
Been thanked: 424 times

Re: Johannes in a Blue Pill

Post by Bigpie »

Oops, I get an error on index.html, cannot parse json.

If I look at request or hit 'http://x.x.x.x/cmd?cmd=json' I get

Code: Select all

j��)
I've tried with the Olimex Mod-WiFi that I know works as I pulled it from my inverter.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
FOCCCI CCS
Post Reply