deadsy / grbl_stm32f4

The grbl g-code interpreter ported to the STM32F4
61 stars 33 forks source link

Could not detect the GRBL version through Universal G-code Sender #10

Open datdadev opened 1 month ago

datdadev commented 1 month ago

First of all, the project is well-coded and super easy to modify with further customization. But there is a problem for the UGS connection after building the project. The console returns as follows:

*** Connecting to jserialcomm://COM3:115200
*** Fetching device status
>>> ?
<Alarm,MPos:0.000,0.000,0.000,WPos:0.000,0.000,0.000>
ok
>>> 
ok
>>> $I
An error was detected while sending '$I': error: Bad number format. Streaming has been paused.
*** Could not detect the GRBL version
**** Connection closed ****

Just a bit curious, if I want to change the pinout of USART and GPIOs, can I do it easily through ./board/gpio.h and ./board/gpio.c?

Moreover, is this library used 0.9j version of GRBL? Or 0.8? Thank you for replying!

datdadev commented 1 month ago

Solved by switching to development branch. I have successfully connected via UART, however, the JOG function does not work. During the compiling and building process with make, I have removed -Werror to ignore those warning, I don't know if I messed up that one? How can I fix this? Thank you!

deadsy commented 1 month ago

It's been a while since I touched this. IIRC the development branch is incomplete. Namely the stepper driver code is not complete. That code was tricky because the original grbl code uses a lot of atmega328p hardware (arduino) and it has to be mapped over to the ST part. At this stage it looks like the grbl project itself is closed and has moved to other projects. The most relevant sucessor seems to be https://github.com/grblHAL. If I get back into this I'll probably try that.

wrt to your questions-

Yes, you can change the gpio assignments in gpio.h

For -Werror - that's my preferred mode. For some third party code it can be tough to fix all the warnings. In any case if you have warnings you should be super careful that they aren't bugs, or just bad practice.

datdadev commented 1 month ago

I used make to build the project, I got these warning:

grbl/gcode.c: In function 'gc_execute_line':
grbl/gcode.c:149:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
  149 |             if (mantissa == 0) { // Ignore G28.1, G30.1, and G92.1
      |                ^
grbl/gcode.c:154:11: note: here
  154 |           case 4: case 53:
      |           ^~~~
grbl/gcode.c:167:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
  167 |             axis_command = AXIS_COMMAND_MOTION_MODE;
      |                          ^
grbl/gcode.c:169:11: note: here
  169 |           case 80:
      |           ^~~~
grbl/gcode.c:673:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
  673 |           gc_parser_flags |= GC_PARSER_ARC_IS_CLOCKWISE; // No break intentional.
grbl/gcode.c:674:9: note: here
  674 |         case MOTION_MODE_CCW_ARC:
      |         ^~~~
grbl/gcode.c:810:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
  810 |           gc_parser_flags |= GC_PARSER_PROBE_IS_NO_ERROR; // No break intentional.
grbl/gcode.c:811:9: note: here
  811 |         case MOTION_MODE_PROBE_TOWARD: case MOTION_MODE_PROBE_AWAY:
      |         ^~~~
      # ...
grbl/report.c: In function 'report_realtime_status':
grbl/report.c:481:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  481 |       if (!(sys.suspend & SUSPEND_JOG_CANCEL)) {
      |          ^
grbl/report.c:487:5: note: here
  487 |     case STATE_JOG: printPgmString(PSTR("Jog")); break;
      |     ^~~~
arm-none-eabi-gcc -I../../board/st/stm32f4/mb997 -I../../board/st/stm32f4/hal/inc -I../../board/st/stm32f4/cmsis -DENABLE_M7 -DSTM32F407xx -Werror -Wall -Wextra -Wstrict-prototypes -O2 -falign-functions -fomit-frame-pointer -fno-strict-aliasing -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wno-error=implicit-fallthrough -Wno-strict-prototypes -Wno-unused-parameter -c grbl/settings.c -o grbl/settings.o
# ...
grbl/system.c: In function 'system_execute_line':
grbl/system.c:238:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
  238 |             helper_var = true;  // Set helper_var to flag storing method.
grbl/system.c:241:9: note: here
  241 |         default :  // Storing setting methods [IDLE/ALARM]
      |         ^~~~~~~
arm-none-eabi-ar rcs libgrbl.a grbl/coolant_control.o grbl/delay.o grbl/eeprom.o grbl/gcode.o grbl/jog.o grbl/limits.o grbl/main.o grbl/motion_control.o grbl/nuts_bolts.o grbl/planner.o grbl/print.o grbl/probe.o grbl/protocol.o grbl/report.o grbl/settings.o grbl/spindle_control.o grbl/serial.o grbl/stepper.o grbl/system.o

And then I just build it and compile it, send to the controller. When I connect and run the command of G0 X1 Y1, or jog to move, it is stucked and not responding:

image

datdadev commented 1 month ago

Note that I have not wire the pinouts to any motor drivers, I don't know if this caused the problem?