GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.simplefoc.com — Debugging ★ Loading... Helpful? How can we improve this page? ✓ Thank you! Your feedback helps improve SimpleFOC docs. On this pageDebugging SimpleFOClibrary sketchesSo you hooked everything up, downloaded your sketch, applied power, and… nothing. Or another common scenario: motor jerks around and makes terrible sounds. Don’t worry! Trust us, we’ve been there. Everyone has this experience, nobody has a working setup on the first try. BLDC motor control isn’t always easy, and there are lots of mistakes to be made. There are different techniques to help you find problems on the software side, but one extremely useful one is to produce some debug output, and having a way to see debug output in a Debug functionalitySimpleFOClibrary provides debug output using the Place this function call early in the or specify the Note: you can also use other serial ports, e.g. Serial1, Serial2, as supported by your MCU. Debugging the motor initThe This is an example of the Failed motor initialization due to the position sensor: And failed motor initialization due to the current sense: Writing your own debug statementsYou can use the SimpleFOClibrary easily for your own purposes: Using this macro has several advantages, see FlashStringHelper, global disable and rationale, below. See the SimpleFOCDebug class header for all available methods. FlashStringHelperThe SimpleFOCDebug macro automatically uses FlashStringHelper, and you should not use the F() macro on strings supplied to the Debug - global disableUsing the build flag RationaleWhy have our own When supporting many hardware platforms (as SimpleFOClibrary does), we can’t make assumptions about the availability of the We also like the abstraction it provides, making it easier to port SimpleFOClibrary to other platforms/frameworks. In future we may abstract the debug output functionality one level further, allowing debug output via SPI, MQTT or other protocols. For this reason it is also good to have a separation between debug and Other debugging methodsPlain old Serial.printlnCan I just use Yes and no… There is no problem with calling Serial.println() in your sketches, you are not forced to use our debug facility as described above. But you have to care not to use too much time for Spare pinsA great way to debug simple things is to use Using this technique will not impact the execution time, and using your oscilloscope or logic analyser you can check the output pin and see things like how long calls are taking to execute, whether the code is taking certain branches, etc… IDE DebuggerUsing a real debugger with SimpleFOClibrary can be a challenge. The code is very real-time dependent, and can’t easily be paused or run more slowly. In the author’s experience using the debugger slows execution to the point that BLDC motor control is quite impossible. But it would depend on the problem you’re trying to catch, the MCU and debugging hardware used and other factors, so keeping the real-time considerations in mind, give it a shot in the debugging tool of your choice and see how it goes. Crowdsource it!We can’t stress enough how much help the SimpleFOClibrary communities can be if you’re having problems! We have a Discourse Forum and a Discord Server you can join any time and ask questions. Our members are both knowledgable and helpful, so rather than sweat it out by yourself, drop by and ask some like-minded souls for advice. Report it!If you isolate your problem, and find it to be our problem, please don’t hesitate to file a bug report on GitHub! |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |