Connection gShield/Arduino to a CortexM4

So I am trying to connect my Shapeoko2 with Arduino/gShieldv5b to a Cortex M4 micro-controller. Motivation is that it has WiFi and I can control it remotely (with a camera setup too).

My connections :

  • Tx of Cortex to pin 0 of gShield
  • GND shorted for both the boards

The cortex has some basic g-code hardcoded

G91 G0 Z-0.5

The Z Axis should ideally move after 0.5mm after this command is sent successfully. It doesn’t.
Am I missing something?

Grbl takes its commands from and gives its responses to the USB connection on the Arduino.

The standalone gShield has NO microcontroller on it.
All the logic is driven by the Arduino itself aka GRBL code.
So unless you plan to replicate the same “Arduino GRBL” code/logic on your Cortex M4, the gShield by itself will not do you any good.

Since he has the Arduino/gShield my assumption was that he is trying to use the Cortex as a terminal emulator to operate his machine. That would work, but he needs to use the USB port and not the serial lines on the Arduino.

Yeah that could work.
We need more details from the original poster about what this “Cortex M4” actually is.
Is it a micro-controller (like Arduino), or actually a micro-computer (like the BeagleBoardBlack or Rasperry Pi)".

The USB connection on an Arduino is actually a serial port afaik. There is an onboard usb-serial converted on the Uno.

It’s MW302, a WiFi microcontroller. It runs FreeRTOS.

I didn’t quite get this. I was under the impression that I could simply bypass the usb-serial converter and connect the pins on the gShield breakout. Why would I have to go through the USB? Is this specific to some part of the grbl firmware ?
Also, thanks !

@AnujDeshpande Like I said, since the gShield has no microcontroller, you need to program the MW302 with actually stepper motor code, OR use the gShield AND an Arduino and plug them into the USB Port on the MW302.
If the MW302 does not have a USB, then connect the TX and RX of the Arduino pins to the RX/TX pins on the MW302.

THEN you need to issue a unlock command. I do not know the GRBL code for that but I assume its in the GRBL documentation. Unlock may be “$X”

What version of GRBL are you running on the Arduino?

I am definitely using the Arduino+gShield combo right now. I don’t want to get into the hassle of porting the entire firmware on MW302. I apologise if my original post wasn’t clear on this.

So the MW302 is only a dumb terminal like @LarryM said.

The MW302 does have support for usb as well as uarts. But I am preferring uarts for simplicity.

The TX/RX of Arduino have been exposed on the gShield breakout. So I mentioned connecting it to that. Again, this was confusing description from my end!

So the unlock code is something I wasn’t aware of. I read this link on the grbl wiki. It didn’t mention any locking code, but it makes sense to have one. I might have to dig deeper.

I’ll keep posted on progress here.

Sounds good! Good luck.
The unlock (Alarm ON) on startup is when you have homing enabled.
From wiki: “When homing is enabled, Grbl automatically goes into an alarm state to remind the user to home before doing anything”

1 Like

[re-write] Just spent some time with the Arduino schematic. Tx/Rx should work as well as the USB interface.

1 Like