Hoverboard main board with simpleFOC

Is the NRST pin connected to the SWD?

If not, you may have to manually reset the board to get it to connect. Are the SWD pins connected to any other hardware in addition to SWD? What’s the power concept when programming the board - do you power it fully or is there a way to only power the logic side for programming?

And is the chip a genuine STM32 part? If not, the STLinks may refuse it.

Yes, but such drivers will have shoot-through protection, so won’t result in the board just exploding…

See for example the logic diagram for the EG2133:

It’s more the rarer cases (like maybe some hoverboard drivers!) which use discrete drivers per FET and therefore have no shoot-through protection. Or mini-drivers where the MCU is directly driving half-bridges made of P and N channel FETs. Weird things like that.

1 Like

Are you sure you got 3.3v gnd pa13 pa14 right?

Just bought this for 10 euros lol

4 Likes

Thanks for all the suggestions regarding my ST-link problem.
I soldered a wire to the NRST pin and connected it via 1k resistor with the RST pin of my “genuine V2 ST-link”. Also fed the driver board from 3.3V of the ST-Link.
Still the same error.
Then tried the “hotswap” option and voilá it connected and gave me the expected “can’t read memory” error.
I changed the option bits to read protection level 0 and erased the whole chip. :grinning:

Now there’s no way back: sFOC or bricked are the options

2 Likes

Is that a kids board with 4" wheels? The hub looks massive…
Can’t wait to see the electronics

Yes 4.5" for kids.
And another extreme for 30e


Will it SimpleFOC? :rofl:

3 Likes

Can only be a matter of minutes to make it work :rofl:

I have a new problem with ArduinoIDE. It doesn’t connect to the ST-Link.
Asked me to install Stm32Cube, which I did. But the Cube SW doesn’t like my ST-Link.
It shows a wrong serial number and doesn’t connect.

I had a deja vú like when the FTDI guys came up with a new driver and all the clones didn’t work anymore…
I hate this $hit…I’m constantly fighting with compiler/environment issues instead of tackling the actual project.
[// rant end]

With platformio I never had any issue. It’s just configured well usually.

I thought, I could fork the simpeFOC github page and create a .bin file. Like I did with the EFeru-github.
But that didn’t work out as I hoped. It compiled 15 different files, 5 of them for STM32-MCUs, but not for the STM32F030.
I guess, some platformio-directives are missing?

That doesn’t come out of the box. You have to add github action.
But it doesn’t make sense for a work in progress project.

I don’t know exactly what did the trick, reinstall StmCube or switch back to the former ST-Link driver.
But suddenly I could flash the chip via ArduinoIDE. :sweat_smile:
Although it still shows not connected
I guess, it shows that message, because the external ST-Links don’t work as serial monitor.

There seems to be a hack to make it work like a V2.1. But I’m too worn out to try that today.
For several reasons it’s a good idea to figure out the real RX0/TX0 pins and use an FTDI adapter for monitoring instead

Some of this wiki can help:

The STLINK serial port is just a pass-through - you need to be connected to the UART tx/rx on whatever board you’re looking at - it does not do serial terminal via the swd pins.

1 Like

Given the price of a STLink V3 Mini I really don’t know why one would mess around with clones :slight_smile:

The VCP connection on the STLink is very practical, especially if the board happens to have the right header to match the STLink. But of course any other serial to usb converter on any serial pins can do the same job… it’s just another piece of hardware to worry about though…

Love the big hoverboard with three PCBs :smiley:

1 Like

I agree, except for when the target does not have ARM-14 header… I have not found a good flying probe set for the v3-mini (with 0.1" sockets). Maybe the black magic probes is a good one to use.

That looks useful!

The Atmel ICE comes with a cable like that, which you can repurpose for your STLink but IIRC the pin1 is annoyingly on the other side… so you have to watch out.

Is the Black Magic specifically for STM32?

I avoid these issues by just putting the right header on my boards. But for an existing board you obviously have to make do with whatever headers they provided…

The black magic probe is really great, it can be used for any targets which are running ARM cores (stm32, pico, maybe esp32? and others).

I agree, it’s better to just put the right header, but I guess they still make the STM32 V3-SET for a reason :grin: too bad it is expensive!

It’s really not… at $40 it’s a bit more than the mini or the clones, but it’s still a very cheap programmer/debugger.

If you look at what they want to charge you for a J-Link (which has the worst software you can imagine) or an Atmel ICE, or any of the FPGA programmers… $150 or more is normal… compared to the competition ST-Links are a bargain! :slight_smile:

1 Like

If you are handy with a soldering iron, there are quite a few adaptors for the STlink V3 on Oshpark like OSH Park ~ Shared Projects by dkonigs

A search for STDC14 finds a lot more https://oshpark.com/shared_projects?search[query]=stdc14&button=&search[filters][pcb_layers][two_layer]=1&search[filters][pcb_layers][four_layer]=1&search[filters][pcb_layers][six_layer]=1&records_date_sort=desc&records_per_page=20

Back to topic.
I figured out, I can only use UART2 on my board.
TX2 is routed to SWCLK, which would be good enough for receiving data on the Serial Monitor.
But I don’t see anything with an FTDI adapter. Even the logicAnalyzer only sees a high on TX.

I suspect it’s the powerOn logic of the board? I tried a jumper on the On-button with a 40V PSU and later used the Charger on the charge-port. Both seem to work, as I could measure 5V for the hall-sensors, but no messages.