Closed dlarue closed 2 years ago
I noticed in my_machine.h there was "#define USB_SERIAL_CDC 1" and comment stating to comment it out for UART comm but that made no difference. I also set USB_ENABLE = 0 in the symbols but tried with USB_ENABLE at 1 and still not grbl output on the UART.
The symbol USB_ENABLE
is no longer used in grblHAL due to conflict with some other frameworks, use USB_SERIAL_CDC
instead as you have discovered. When USB_SERIAL_CDC
is not defined or set to 0 UART comms should be default. One way to check this is to see which part of the code gets compiled in driver.c:
Here you can see usbInit()
is greyed out and serialInit()
is active. Note that sometimes the greyed out parts might be wrong, right click on the project folder in the IDE and select Index > Rebuild to be sure it is correct.
Do you have a ST-Link and can set breakpoints? serialWriteS()
in serial.c is the first place to check, is it ever called? If not has the board gone into a hardfault? Press the pause button to check if so.
I checked and it is flowing through stream_connect(serialInit()) and to be sure I removed USB_ENABLE and set USB_SERIAL_CDC 0 in my_machine.h and still nothing on the serial output.
I am using ST-Link to upload firmware but don't know yet how to use it to set breakpoints. That would be very handy to have working. Currently I'm only using the ST-Link via OpenOCD to upload code. I'll see if I can figure out how to get debugging happening.
I removed USB_ENABLE and set USB_SERIAL_CDC 0 in my_machine.h
I assume you removed OVERRIDE_MY_MACHINE from the IDE symbols then...
To set a breakpoint just double click to the left of the line number:
I was just covering my ars by making sure it was in both places. :-)
I have debugging working and it's breaking at line 103 in serialWriteS()
Seems to be wanting to print "error:7"
And wow, this was fairly easy to setup...
error 7 is failure to read settings, either from flash or EEPROM - I belive I saw that this board has an EEPROM mounted, but possibly interfaced via SPI? grblHAL supports I2C EEPROMs.
If you send a '?' do you get new output in serialWriteS? You can also set breakpoints in the USART1_IRQHandler to see if RX and TX interrupts fires.
I'm testing this on a Bluepill board so no external EEPROM. I will connect up my FTDI board(3.3V) and minicom and see if there's any reaction.
ok so this is different. It's in debug mode and I connected the FTDI board and now I'm getting stuff!
? error:7
Grbl 1.1f ['$' for help] [MSG:'$H'|'$X' to unlock] ?<Alarm|MPos:0.000,0.000,0.000|Bf:35,512|FS:0,0|Pn:PXYZRHS|Ov:100,100,100>
and $$ gives me settings. $$ $0=10.0 $1=25 $2=0 $3=0 $4=7 $5=0 $6=0 $9=1 $10=511 $11=0.010 $12=0.002 $13=0 $14=0 $15=0 $16=0 $17=0 $18=0 $19=0 $20=0 $21=0 $22=0 $23=0 $24=25.0 $25=500.0 $26=250 $27=1.000 $28=0.100 $29=0.0 $30=1000.000 $31=0.000 $32=0 $33=5000.0 $34=0.0 $35=0.0 $36=100.0 $37=0 $39=1 $40=0 $43=1 $44=4 $45=3 $46=0 $62=0 $63=2 $64=0 $65=0 $100=250.000 $101=250.000 $102=250.000 $110=500.000 $111=500.000 $112=500.000 $120=10.000 $121=10.000 $122=10.000 $130=200.000 $131=200.000 $132=200.000 $341=0 $342=30.0 $343=25.0 $344=200.0 $345=100.0 $384=0 ok
it will run through the debugger either single stepping or just running but it will not run when powered via USB. I realized the firmware size was over 64K again( 111K ) and couldn't figure it out. Seems single stepping or running through debug literally loads the code as it runs. Well, I went to see if another programmer besides openocd was around and STM makes one and so I installed it and flashed 111K image and now the Bluepill runs from USB power and with the FTDI connected to a9 and a10.
That took a while but I now have in-circuit debugging working and have another programmer option.
Next step is now figuring out how to move the PWM/spindle to PB0.
I figured out what the ioc file is used for and loading it in CubeIDE loaded a visualization of the pin assignments and I see USART_TX on PA9 and USART_RX on PA10. I built and uploaded the firmware and connected a 3.3v FTDI Rx pin to PA9 and see no grbl output. I have set compatibility to 1 in config.h and I tried USB_ENABLE to both 0 and 1 and neither results in any grbl header echoed out USART_TX pin.
To test, I uploaded a grbl32 firmware and upon powerup saw grbl setting and version dump. So the board and aux port is operational.
CubeIDE Symbols: