Support for HDSC chips (HC32F460)

You’re looking at the Y stepper, not X stepper.

on my board the R21 is also soldered to the x driver, looks different to the previous posted pictures… how I should proceed to get on klipper?

R21 is soldered on mine too. The soldering step is optional if you’re willing to use my fork: GitHub - Jookia/klipper at tmc2209f

1 Like

Thank you for quick feedback, I will try it with soldering and Sonic Pad

EDIT: Wow, it took just 10minutes to start with the Sonic Pad. I am new on 3d printing and just bought the Kobra for printing a Hydro Grow Tower for my wife. The tower is printed, my wife is happy, and I got a new hobby🤣

On Ender 2 Pro stock board HC32F460

Made some tests on signal pin yellow pwm, seems to be working fine.

                                                       tested values w/ multimeter

‘pin_down’: 0.000650, 0.106V ok
‘touch_mode’: 0.001165, 0.191V ok
‘pin_up’: 0.001475, 0.242V not ok (BLT enter in a limbo mode up and down like signal pin was disconnected)
‘self_test’: 0.001780, 0.292V ok
‘reset’: 0.002190, 0.359V ok
‘set_5V_output_mode’ : 0.001988, (not tested)
‘set_OD_output_mode’ : 0.002091, 0.343V (act as pin_up and set 5V on sensor pin instead of letting the board 3.3V pass to negative)
‘output_mode_store’ : 0.001884, (not tested)

I have edited the bltouch.py command pin_up pwm period from 0.001475 to 0.002091. Still testing but seems to be working. works well on Z probe pins with PB0 (sensor) as well on creality board bltouch socket configuring PB2 as sensor pin. It´s the same. Pin up only showing triggered after i send the command touch_mode but I believe this is a fake copy of a clone! I mean fake copy of a 3D touch. I made it cheap for test purpose. Believe now I can get a real BLTouch.

Hi making a followup of your problem. i have the same start great… and then start loosing packets. changed cable no luck

Thanks @SteveGotthardt for all the hard work with the HC32F460. Very usable already on the Ender 2 Pro S4 board. I do have some suggestions for future improvements though. I noticed that the SWDIO pins, PA13 and PA14 are not configured as I/O pins by Klipper like they are on ST processors. In my ideal world I would like the configuration to be such that PA13/14 would be selectable as UART pins in the menuconfig as I would like to connect my RPi using a serial port rather than via an external USB cable. If those pins would not be selected in the make menuconfig, they would be available as regular I/O for controlling fans etc. I have a feeling this chip will be pretty popular in the printers as it is powerful and low cost so the development would not be in vain. There is a constant lack of free I/O pins in the built in boards by the manufacturers.

Thanks for pointing that out specifically. I’ll take a look soon. I have been getting a house ready to sell and I haven’t had a lot of free time.

2 Likes

Another minor thing would be to be able to read the mcu temperature. Does not seem to work the same way as with ST processors.

1 Like

I have a PR coming to add the PA13/14 as UART pins. (after my 168MHz one)
The mcu temperature is available but not through the ADC (as you pointed out). I don’t know if it will need it’s own file or if I can ‘force’ it into temperature_mcu.py

1 Like

After some here have tried and failed, I also tried to install a 3DTouch Probe on a Creality V2.4.S4 board (Ender 2 Pro), with the same result that it does not work.

But with a logic analyzer, I could see that PWM somehow works on both pins (PB1 & PB2). Since I saw the 168MHz PR from @SteveGotthardt, I reflashed my board, this time with 168MHz, instead of the previous 200MHz.

Thereupon the probe worked immediately with PB1 as control_pin and ^PB2 as sensor_pin :partying_face:
I also saw that the PWM period changed from 23,8ms to 20ms after this change. So thanks for fixing this!

1 Like

Bonjour J’ai vue la meme question au sujet de la température du mcu sur les anycubic kobra c’est peut-être pas grand choses mais avec ca on pourrait faire fonctionner le ventilateur de la carte mere et encore bon travail pour la prise en charge du microprocesseur (hc32f460)

This is an English speaking place. Please stick to it, so that other users may profit as well.

On est en 2023 la traduction automatique ca existe

Also for you… - so please

I get the new anycubic Trigorilla Board (Pro B 1.0.2). This is original used by the Kobra2 but i get this as spare Part for my Kobra Max. I found out that he change the serial connection to PA9/PA15. I can flash and connect to klipper and can do a homing but i cant controll heater and fans. I dont know why. Maybe we can research together.

Hi Fragmon, Is it possible I can get the .bin file to try this? I have the Pro B 1.0.2 and cannot get it to connect. Thanks!

@SteveGotthardt , I noticed that the pull requests to enable the SWDIO pins PA13 and PA14 as regular I/O had been accepted during the summer so I finally got to test them but I had little luck on the Ender 2 Pro.
What I did is I refreshed my Klipper to the latest on the Github (Host v011.0-267-g01ed8096, mcu v011.0-173-ga8b1b0ef-dirty) and compiled the code still to use the USB so I could test the operation of the PA13/14.
First I built a firmware to still use the USB for communication and tried configuring the PA13 and PA14 as outputs in the printer.cfg so I could try setting the pin values to either 1 or 0 from the console and check with an oscilloscope. No matter what I did, the pins were stuck on the high state.
To further verify, I built another firmware to use the PA13/14 for communication and was able to see that my Raspberry Zero W 2 was trying to send to PA13 but PA14 was still constantly high.
I noticed on Github that Bobo1239 (issue #6259) had made a commit on Jun 17 supposedly releasing PA13/14 to be used as general purpose I/O but at least I don’t seem to get them working. I wonder what I’m missing. I don’t see him on the discourse but I try to share a link for him in an Email to bring him on the same page.

Hi @jorkki, I’ve just tested using PA13/14 for serial again and at least with my HC32F460 devboard it still seems to work using the latest klipper commit. (tested with klippy/console.py)
Apparently UART pulls both lines to high during idle so we can’t use that as an indicator for failure. (for reference I’m measuring 2.8V on PA14 and 3.3V on PA13)
Have you already tried using a regular USB UART adapter on your PC and directly connecting to PA13/14 (+ GND)? Then you can try something like cd klipper/klippy && python3 ./console.py /dev/serial/by-id/.... (also try swapping the pins just in case)
Expected output should be something like:

==================== attempting to connect ====================
INFO:root:Starting serial connect
Loaded 73 commands (?-20230823_220659-fd74fd0894ae / gcc: (15:6.3.1+svn253039-1build1) 6.3.1 20170620 binutils: (2.27-9ubuntu1+9) 2.27)
MCU config: ADC_MAX=4095 CLOCK_FREQ=200000000 MCU=HC32F460 PWM_MAX=65535 RECEIVE_WINDOW=192 RESERVE_PINS_serial=PA13,PA14 SERIAL_BAUD=250000 STATS_SUMSQ_BASE=256 STEPPER_BOTH_EDGE=1
INFO:root:Resetting prediction variance 53616.712: freq=200000000 diff=-9998281 stddev=200000.000
====================       connected       ====================

(note the RESERVE_PINS_serial=PA13,PA14)

Sorry Boris and Steve for bothering you for nothing.
Turned out that once again the problem was between the keyboard and the chair.

I hadn’t noticed that the Ender bootloader didn’t like multiple files being in the \user-folder on the SD and had not loaded the changed file. Only noticed this when I tried to temporarily restore the original firmware. For a minute I though I had managed to crap the bootloader but fortunately it was ok and everything started working when I removed the extra files.

I’ll report back if I discover any anomalies after I have time to mount everything and start using the serial for printing.

Thanks again for all the hard work you have done for this.

1 Like