I have a BigTreeTech closed loop stepper (S42C v1.0) and it apparently allows UART communication to read and write settings. I have two questions based on the following information from the "manual":
You are best off with an Arduino with multiple UARTs for your device and debugging on PC, like an Arduino Mega. Else you need some SoftwareSerial for the second serial connection.
For the protocol you should learn to use logic OR '|', AND '&' and shifts '<<' and '>>' - see the Arduino Reference.
A link to the complete datasheet were nice for answering your other question(s).
According to the STM32G031xx datasheet PA2/PA3 is one of the USART options. The configuration of these pins between 3.3v and GND looks suspiciously like the kind of interface I need.
When I get a chance, I'll see if I can at least communicate with these pins via my PC.
The note that the device uses a "uart mode" tells me they are using bit-banging instead of a real UART. The software method was cheaper than using a real UART in the device. Perhaps space on the circuit board was the reason.
In any event you need to write to the device using a regular Arduino UART or use software serial.
The document identifies exactly how to format you message. The sync bits at the start of each message is there so the device software can discover that a message is arriving and begin to decode it.
UhOh! DO you see the pin identified as SWCLK???? Does that mean the communication is actually synchronous with an external clock? If so, your async will not work.
@Paul_KD7HB i'm in no way an expert in this, but I think there is a separate interface for flashing the firmware to the processor. I think that might be what those additional pins are for? J-Link?
I've connected the Stepper motor pins PA2 and PA3 through an ESP32 onto my Arduino IDE serial monitor and plotter. I used this basic code to spit out what was happening on those two pins: