Open c-morley opened 3 years ago
I am not sure what you are asking for. I was using a Teensy 3.2 which uses an ARM chip from NXP/Freescale, but it should also work on an STM32. As I said in the README, the code is easily adapted to another microcontroller and framework.
As I understand it your code is the library to do sserial. I was looking for example code using your library. Blinking the LED on each linuxcnc read request would probably be enough. I'm very new to micros
My code isn't actually written in library form, it's a template. I got help from Peter Wallace of Mesa Electronics, as well as used some code on LinuxCNC's forums as a guide. I don't 100% implement the LPB8 protocol, nor do I claim to. I would love to eventually make this into library form with an API and such, but at the moment it's just a functioning reference. If you aren't versed in C programming nor microcontroller development, there might be a steep learning curve.
That being said, the code actually does blink an LED currently in response to communication with LinuxCNC. It's set up to have an input and output 32-bit integer values. The "input" value (from the device to LinuxCNC) is just a counter to show that it's changing with every read, and the "output" value is stored but not actually used at the moment. See these lines:
preparing data going out to LinuxCNC: https://github.com/fdarling/mesa-smartserial-device-template/blob/a29ee45c41fa3f7d7e5b37cf8b2d2a77e05f2472/Mesa_SmartSerial_Device_Template_Project/Mesa_SmartSerial_Device_Template_Project.ino#L318
using data coming from LinuxCNC: https://github.com/fdarling/mesa-smartserial-device-template/blob/a29ee45c41fa3f7d7e5b37cf8b2d2a77e05f2472/Mesa_SmartSerial_Device_Template_Project/Mesa_SmartSerial_Device_Template_Project.ino#L324-L333
where the pins are defined: https://github.com/fdarling/mesa-smartserial-device-template/blob/a29ee45c41fa3f7d7e5b37cf8b2d2a77e05f2472/Mesa_SmartSerial_Device_Template_Project/Mesa_SmartSerial_Device_Template_Project.ino#L80-L101
Again, this will have a steep learning curve if you don't have the background knowledge in C, microcontrollers, and the Mesa Electronics documentation on the protocol.
Ok thanks - I misunderstood what you meant by template. Thanks for the tips - I'll see what i can accomplish.
Do you have test code to try? I would like to use STM32 with Arduino IDE. Did you know that there is a guy who did something similar with the STM32 f1.f4 but using the STM IDE (which is very complicated)
https://forum.linuxcnc.org/41-guis/38222-usb-haas-operator-panel-interface?start=20