I’m still investigating this issue, but I’m posting to see if anyone else has run into similar problems. Using with-serial on the Teensy 4.0 appears to send output to the USB serial console instead of the actual serial outputs.
Steps to reproduce:
- Obtain a Teensy 4.0
- Flash uLisp 4.1a
- (optional) Hook up an oscilloscope to to Pin 1 (TX of Serial1)
- Open serial console, define the following function:
(defun serial-test ()
(with-serial (s 1)
(write-byte 45 s))) ; 45 is the hyphen character ‘-’
- Evaluate (serial-test)
On the scope, you can observe that TX output goes from low to high (as a result of with-serial calling Serial1.Begin() on the appropriate port), but then immediately goes back down without transmitting char 45.
On the USB console, you can observe the ‘-’ character printed, suggesting that this is going to the USB console instead:
uLisp 4.1a 59999> (defun serial-test () (with-serial (s 1 96) (write-byte 45 s))) serial-test 59974> (serial-test) (serial-test) - nil
Aside, the (with-spi) form does appear to work correctly with (write-byte), so this issue might be isolated to serial.
I suspect something is going wrong in pstreamfun or sp_withserial, but would need to do some more poking to find out.