bigtreetech / BIGTREETECH-S42B-V1.0

The closed-loop drive is to feedback the rotation angle of the stepping motor to the control panel, compare the distance that needs to be rotated with the distance of the actual rotation, calculate the error value, and then compensate, so as to prevent the problem of multi-step and lost step. The closed-loop drive can completely overcome the lost step of the open-loop stepping motor, and can also significantly improve the performance of the motor at high speed
109 stars 53 forks source link

UART communication to set PID values with BTT Writer #61

Open CKCMorgoth opened 1 year ago

CKCMorgoth commented 1 year ago

Hello there I added 2 S42C steppers to my printer and now I have the problem that my prints result in heavy ghosting, so I checked multiple posts in here and decided to try to set the PID values until the firmware for the S42C become opensource. Since I dont have an arduino available right now, I decided to try the BTT writer I got for my Wifi modules, since it is basically a CH340G USB to Serial converter. I set the level jumper to 3.3V, connected GND to GND, 3.3V to 3.3V, Receive from the CH340 went to PA2 and transmit of the CH340 went to PA3 which are the UART pins for the STM32G, and plugged it into my USB port. Nothing went on fire and the display of the stepper display the normal menu, so I was happy for that :) Now I wanted to read the current PID values, first attempt was putty, set it to the right COM port, baud rate set to 9600 (checked that on the OLED) and connected, which worked, but didnt give me any output. Next try was the serial monitor of the arduino IDE, but this kept blank too. Last try was to try realterm, which also seemd to connect to the interface, but still no output, and also realterm showed me no status info for the connection, everything stayed grey. So in my opinion, either I misjudged the BTT writer of being capable of communicating by UART and I will need to get an Arduino, or I misswired something, or I didnt get into using UART right.

Can anyone tell me where to start to get this setup running? Thanks in advance and greeting Morgy

CKCMorgoth commented 1 year ago

Okay with the help of some work colleagues I got it figured out, telling you how I did it so you dont need to wildly guess like me ^^

Connect the BTT writer with the S42C like mentioned above Download HTerm Connect the COM port send binary 10101000 10000110 to read the PID values (change answer to ascii to get clear text) write I value with 10101010 00000111 0000000 00000000 for I = 0 or 10101010 00000111 00000000 11111111 for I = 255 write D value with 10101010 00001001 00000000 00000000 for D = 0 and save with 10101010 00011000 00000000 00000000 You will receive a "S42C_V1.0" message

Congratulations, you successfully overwritten the (P)ID values of your S42C motor