Closed Whitelock-MT closed 2 years ago
Do I understand you correctly, you want to use the UART connection to connect as sender to grblHAL?
If so, in my_machine.h, around line 52, change:
#define USB_SERIAL_CDC 2 // 1 for Arduino class library and 2 for PJRC C library. Comment out to use UART communication.
to
//#define USB_SERIAL_CDC 2 // 1 for Arduino class library and 2 for PJRC C library. Comment out to use UART communication.
and rebuild grblHAL.
A better solution is to use ethernet but that takes a bit more work on the pi side.
So tried that and while the USB communication stops, the Pi gets no response from the serial connection
(Also tried simple debugging on the Pi's end, it has a python script reading the serial port and if the teensy has the below code on it, then the pi receives the 'Hello' message every second)
void setup() {
Serial1.begin(115200);
}
void loop() {
Serial1.println("Hello");
delay(1000);
}
Stop bits and parity? 8N1, I believe. I've gotten it to work in the past with the Teensy 4.1 though not recently. Terje will probably have some ideas.
UART communication is working for me with the latest version (and I have used it since the start for debugging so it should work with older versions too).
By default pin 0 (RX) and 1 (TX) is used. How did you wire the Pi?
Stop bits and parity? 8N1, I believe.
Correct.
Do you have USB to serial converter? It might be worth trying that. Most of them have tx/rx lights so you could see if there is activity, if nothing else.
Thats the PI's python script, (on the chance ive done something wrong there, tried many different codes to send on the chance it was wrong to send '$$'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import serial
import time
ser = serial.Serial(
port='/dev/ttyS0',
baudrate = 115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
time.sleep(1)
ser.write('$$')
while 1:
x=ser.readline()
print x
I don't have a USB to serial, though I have another teensy (and an Arduino I could try with) as well as a oscilloscope if I should just monitor the Rx/Tx pins
It does appear to be a naked teensy problem
pi@Cnc:~ $ cd Desktop/ pi@Cnc:~/Desktop $ nano serial_uart_test.py pi@Cnc:~/Desktop $ python serial_uart.py <Door:1|MPos:0.000,0.000,0.000|Bf:35,1023|FS:0,0|Pn:D>
Thanks so much the both of you.
Great! Glad you got it sorted out.
By the way, if you are writing your own sender, you will want to read up in the Grbl wiki about writing a sender and in the grblHAL Wiki as well.
Hey,
I'm swapping from using GRBL on a Arduino to GRBLHal on a teensy, on Arduino the USB serial port and the GPIO serial are hardwired together, in the teensy this is not the case, I am having trouble changing the serial connection to these pins, help/advice would be appreciated.
End goal is to use a pi as a sender.
Thanks Kindly