We discussed about Deadtime compensation in the other thread.
I received the boards and tried running in openloop with a hoverboard motor but I wasn’t successful yet, bear with me it’s the first time I use simplefoc.
As I wasn’t sure the serial monitoring is fast enough to visualize the phase current, I used another approach that worked well for me in the past with STM chips.
In platformio.ini, I added -g -ggdb in the build flags.
I declared a variable outside the loop
I populated this variable in the loop
current = currentSense.getPhaseCurrents();
I am then able to visualize the phase current in STM STUDIO:
Hey Candas1, I want to try this, but I don’t know how to set up current sense, not quite. I have some idea but am painfully aware of how things can get complicated.
Can you post the exact code you used? I can extract the critical elements and make some elemental code to monitor current with this board.
I want to monitor current to do stall detection. The best thing for me is to watch the combined current of all three phases. That way I can take a single measurement and see what the current draw is, no need to average out a bunch of measurements on a single phase.
I have been using STMViewer for some time now, I must say I like it.
You can add a variable, type the name of any global variable like motor.LPF_current_q.Tf, update the variable address, and it just works.
Yeah but after downloading it, like what’s the process? You compile with arduino, how does it know the memory address? Doesn’t it need to have info from the compiler somehow to know the address of a variable and it’s name? I don’t see how it can get that info.
Oh ok a video is awesome, sorry. Will check it out thanks! Looking in there and seeing the system working is extremely important but in arduino it’s quite hard.
Edit:hm, how do you get this mysterious .elf file? It’s the binary I take it?
I never figured out build options with arduino very well, but there was a file specific to each family of boards that contained a section where the build options were located. There are some instructions I think I left on the forum for modifying some of them in some ways, the build options were needed to get current sensing working with the b-g431b-esc1 board.
Why would you use platformio’s debugger from inside ArduinoIDE? That doesn’t make that much sense for most people, I think.
At that point it would be easier to just use PlatformIO, for code and debugging, and not have to deal with the idiosyncrasies of both IDEs at the same time?