How to use GRBL functions without serial communication?

Hello, I have a project with mega arduino.

The project has an SD reader, 2 step motors (x & y), display 16x2, 2 limit switches and a power button.

The project uses AccelStepper to move the stepper motors but due to the speed of the system I need it to use multitasking.

How can I use the grbl functions from the same arduino board? Without serial communication?

I want it to work as the 3D printer works, without using 2 arduino boards.

PD: I use DM542 driver controller for steeprs.

Greetings and thanks.