grblHAL / core

grblHAL core code and master Wiki
Other
304 stars 73 forks source link

Porting to XMC MCU #318

Open sai-ydev opened 1 year ago

sai-ydev commented 1 year ago

I want to port grbHAL to Infineon's XMC MCU. I am doing this out of academic interest.

I read through the wiki and I have a vague idea from reading the Compiling grbHAL page:

Most of all, can I ask my questions here in issues if I run into problems?

terjeio commented 1 year ago

what are the flash/RAM requirements that I need to keep in mind?

You can get away with as little as 20K RAM but you need at least 128K flash. How much is required above that depends on the optional features you want to implement. Native USB, ethernet, large block buffer...

When it comes to peripherals, are there specific peripherals that the MCU needs to have?

At least one UART port (this is the first you want to bring up, use a UART <> USB bridge to communicate with the MCU). At least two timers, easier to code if one is 32 bit (for the main stepper interrupt). I assume there is a systick timer available, used for the 1ms clock - this is required for many plugins. Enough GPIO pins to drive at least three steppers and handle the other outputs/inputs you want to support: coolant, spindle control, spindle PWM, limits and control inputs.

Is config.h the place to configure hardware options for my new MCU?

No, _mymachine.h and a map file in the driver is used for that. The driver tells the core what is available via the HAL.

Most of all, can I ask my questions here in issues if I run into problems?

Yes.

I wrote a template driver some time ago, this is now somewhat outdated and should be brought in line with the latest core version but might be a little helpful nevertheless. I would start off by copying an existing driver, comment out hardware specific code in driverc and bring up a UART (code is in serial.c) to establich communication. Then replace the commented out code with code matching the MCU. Optional features can of course be removed. The STM32F3xx driver is a good candidate to start with, a little downside with that is the somewhat odd/complicated GPIO interrupt handling.

sai-ydev commented 1 year ago

Thanks for patiently answering my questions. I will keep this thread updated.