Page 7 of 20
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 26, 2025 6:29 pm
by diglet
The relevant value in the datasheet for our use case is the DC resistance, not impedance. For the primary this is 12 ohm, and for the secondary 0.5 ohm (only half the windings are used in this device, so 0.25 ohm in practice).
It isn't clear to me what you mean by K, why assuming 4 ohms makes any sense, or what you are referring to with "the 400 ohm version".
The load the device will see is inductor resistance + secondary resistance + (primary resistance + skin resistance) / winding ratio squared. Skin resistance varies between 50 and 1000ohm.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 26, 2025 9:21 pm
by dr_bearcat
diglet wrote: Sun Jan 26, 2025 6:29 pm
The relevant value in the datasheet for our use case is the DC resistance, not impedance. For the primary this is 12 ohm, and for the secondary 0.5 ohm (only half the windings are used in this device, so 0.25 ohm in practice).
It isn't clear to me what you mean by K, why assuming 4 ohms makes any sense, or what you are referring to with "the 400 ohm version".
The load the device will see is inductor resistance + secondary resistance + (primary resistance + skin resistance) / winding ratio squared. Skin resistance varies between 50 and 1000ohm.
I cant find winding ratio in datashit. Where did you find it?
Different windings can be made with different wire diameters (so have different resistance) and cannot be an indication of the transformation ratio (K).
Only by knowing the winding ratio we can know exactly the transformer ratio, but I can't find it.
By 12/0.5 ratio we get K = 25 isnt it too much ?
what you are referring to with "the 400 ohm version". - 42TU400-RC
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Sun Jan 26, 2025 11:53 pm
by diglet
The winding ratio is the square root of the impedance ratio, 5 for the 42TU200-RC, 10 in our particular configuration.
There is nothing about the 42TU400 that is 400 ohm. If you use the 42TU400 you will have slightly higher winding ratio, slightly higher output power, and slightly higher maximum shock in case of equipment failure. It is not worth changing the default transformer imo.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 8:36 pm
by digitalparkinglot
Hey Group,
I am attempting to build a FOC-Stim device. I have all the components to build it but I have not assembled it yet. I thought I would go ahead and get the B-G431B-ESC1 Discovery kit set up first before assembling everything. I plugged a USB cable into the B-G431B-ESC1 Discovery kit and I get two green lights and a flashing red light. I then opened up STM32CubeProgrammer to update the firmware. When I try clicking the "connect" button it gives me "Error: No debug probe detected." Is this happening because I need to assemble all the parts first...including running power to it?
I'm good at connecting parts together. I can sort of read a schematic. I don't really understand what the various electronic parts do or why they are used. I know absolutely nothing about coding. I would be very grateful for any help you all can give me.
Thanks!
-digitalparkinglot
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 8:59 pm
by diglet
You should be able to update the firmware without anything else connected to the board, only the USB port.
To update the firmware you need to click the blue 'update firmware' button, located at the right edge of the screen.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 9:10 pm
by digitalparkinglot
diglet wrote: Wed Jan 29, 2025 8:59 pm
You should be able to update the firmware without anything else connected to the board, only the USB port.
To update the firmware you need to click the blue 'update firmware' button, located at the right edge of the screen.
Thanks for responding Diglet.
When I click the 'firmware upgrade' button this new window opens and everything is grayed out. If I hit the refresh device list it still is empty and everything is grayed out.

- Programmer.jpg (182.57 KiB) Viewed 4951 times
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 9:16 pm
by diglet
That's odd, on my machine it shows the device in that list.
Can you install this driver? I don't remember doing it on my machine, but maybe it helps...
https://www.st.com/en/development-tools ... nk009.html
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 9:36 pm
by edger477
The device that this firmware upgrader talks to is using this driver
My boards had old firmware that was reconnecting and I tried replacing this driver with generic one, but it did not help, since problem is not in the board itself, but that development daughterboard that does com-port-to-usb. That one is composite device with this virtual com port and a usb flash drive. This driver "virtual com port" is required for flasher to work (and it seems to be standard microsoft driver)
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 10:07 pm
by BlackHatAnon
+2 for the Link009 driver. I installed this prior to flashing my boards. Should solve your issue DPL (fingers crossed)
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Wed Jan 29, 2025 10:54 pm
by digitalparkinglot
Still no luck. I installed the link009. I've tried on two machine and both give me the same grayed out buttons. I did an "install legacy hardware" and found STMicroelectronics STLink Virtual COM Port and installed that. This is what I get in the Device Manager...it says "This device cannot start. (Code10)". Even with this everything is still grayed out. I REALLY appreciate your help. Any other ideas?

- Device Manager.jpg (146.3 KiB) Viewed 4916 times
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 30, 2025 2:09 am
by emiumfinal
Ok, did some more playing around and edited this for my new issue. I can get restim to connect to the board successfully on COM3, but I can't also get teleplot to show anything. If I try to connect teleplot with restim already connected I get an access denied error and vice versa (I assume because they are taking exclusive control of the port). Should I be able to connect them both to the serial port, or is teleplot getting data from restim via UDP? I have the UDP ports set up the same, but nothing seems to be working. Do I need something in the teleplot prefix field in preferences?
I'm also getting a constant error - V_BUS too low or something similar - I'm assuming that is because I haven't finished assembling the board and hooking up 12V power? Right now I am just running it with the USB connection powering the board. Just don't want to build out the board if there is some other issue I need to sort out first.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 30, 2025 2:22 am
by digitalparkinglot
After quite a bit of searching I think what my problem may be is that my micro USB cables may only be for charging and not for data. I didn't know there was such a thing as a charging only micro USB cables. I just ordered a couple cables that support data that should be here Friday. Hopefully that fixes my problem...fingers crossed.
-digitalparkinglot
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 30, 2025 3:02 am
by Bouncyboingboing
I was just about to say that I'm having the same issue as DPL. Then saw your post above about the cables.
Tried a different cable (came with a UEBoom I think) and the board connected immediately. So hopefully a new cable is all that's required for you DPL.
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 30, 2025 3:38 am
by Bouncyboingboing
However.
I'm totally lost on what to do now. I thought I might be able to figure it out intuitively but I'm sorry I'll need some more ELI5 instructions if anyone can provide them? The software STM32Cube programmer looks nothing like the screen shot on diglet's github.
Many thanks
Re: FOC-Stim: a new approach to DIY stim hardware.
Posted: Thu Jan 30, 2025 4:40 am
by emiumfinal
Bouncyboingboing wrote: Thu Jan 30, 2025 3:38 am
However.
I'm totally lost on what to do now. I thought I might be able to figure it out intuitively but I'm sorry I'll need some more ELI5 instructions if anyone can provide them? The software STM32Cube programmer looks nothing like the screen shot on diglet's github.
Many thanks
The screenshot is the Visual Studio software, not the STM one. The STM one is used to upgrade the firmware (there are some posts earlier that have screenshots of that). You use the Visual Studio program with the platformio plugin to load the FOC-Stim platform.io file and upload it to the device. That is what the screenshot shows.