Johannes in a Blue Pill

User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

Small batch pcb manufacture especially with any type of consistency is very expensive and difficult at least in my part of the world. Anything that offsets that and helps people get cars moving is a good thing in my book. Of course full smd cards are my preference whenever possible.
I'm going to need a hacksaw
User avatar
johu
Site Admin
Posts: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

@yaroslav: I took the liberty to move your questions to another thread you started, they don't fit in here.

What I was actually gonna say: I configured the timer to not rely on the ETR pin in single channel mode. In other words you can use single channel mode with the Blue pill now. Source code on github, no release yet.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

Possible bug : When attempting to start in closed loop mode on blue pill inverter trips with a error desat message despite the desat pin showing as na.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

So think I found the desat problem. The desat pin is being mapped to a pin that reads 0 in the blue pill hw rev. Desat is active low:) tied it to a high pin and that gets rid of desat error but now getting stop overcurrent error.
I'm going to need a hacksaw
User avatar
Bigpie
Posts: 1595
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 304 times

Re: Johannes in a Blue Pill

Post by Bigpie »

I'm still having issues with my bluepill if any one can suggest anything that may help.

I've flashed a blink to it and the led blinks.

I've then flashed stm32_sine.bin from github. Connecting to the UART pins on raspberry pi (8 & 10) and connected them to B10 and B11 on the bluepill.

The web interface times out fetching the parameters

echo -n "help" > /dev/ttyAMA0

has no response.

If I connect the RX and TX on the pi together and use minicom -D /dev/ttyAMA0 then what I type is echoed back.

Flashing just the bootloader gives 2D repeating over the serial so I must be doing something wrong when flashing the firmware.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
johu
Site Admin
Posts: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

Sounds good :)
Try
echo -n "list\n"
Or better use miniterm.py from the python-serial package

The culprit with the web interface could also be permissions. Say webserver runs as user apache and /dev/ttyAMA0 is in group "dialout" then you need to add that group:

Code: Select all

sudo usermod -aG dialout apache
Please check for the actual user and group name, not sure what it is on the Pi
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Johannes in a Blue Pill

Post by Jack Bauer »

So looks like the tim1 brk isr is being called constantly regardless of the state of the bkin pin. Desat was just the first reported error in that routine. Then noticed that POT was reading strange. Disconnected the throttle and it jumped up to 3.2v. Seems our pot pin in the bluepill is uvlo on other boards and has pullup enabled. Disabled this for testing and pot pin now works. Seems like we have some conflict in the routines for setting the io lines.
I'm going to need a hacksaw
User avatar
Bigpie
Posts: 1595
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 304 times

Re: Johannes in a Blue Pill

Post by Bigpie »

thanks johu, list works, so that narrows it down to an issue with the web interface.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
Bigpie
Posts: 1595
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 304 times

Re: Johannes in a Blue Pill

Post by Bigpie »

Is there some logic that prevents the pwm output in mode 2?

I've issued 'start 2' followed by 'set fslipspnt 10' and 'set ampnom 10' but the PWM is not generated.

*EDIT*
I've looked through the code, and I think I might need to pull B1 high? I'll give that a bash tomorrow.
(DigIo::Get(Pin::emcystop_in) && DigIo::Get(Pin::mprot_in) && DigIo::Get(Pin::bk_in)) all these look to be mapped to B1 on the bluepill
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
johu
Site Admin
Posts: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 times
Contact:

Re: Johannes in a Blue Pill

Post by johu »

bk_in is on PB12 and it must be because it's the hardware break input of the timer. It seems there is a problem with it, Damien and me are currently investigating.
PB1 is expected to be tied high for normal operation with the start input but is irrelevant for manual operation.

Will get back here once I found out more.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 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 166 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: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 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: 1595
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 304 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
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 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: 1595
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 304 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.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 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: 287
Joined: Sun Jan 19, 2020 2:33 pm
Location: Minsk, Belarus
Been thanked: 5 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: 835
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 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: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 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: 835
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 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: 5789
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1023 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
Post Reply