Just a head's up: If you're going to DMA data from a T4 UART, disable the UART FIFO during setup!
Longer version:
I've returned to working on a Teensy-based controller for my Trossen Hexapod robot. The servos use a 1Mb async TTL interface, faster than I wanted to handle with interrupts. I had gotten DMA working with a T3.5, but life intervened...
Over the summer I laid out a a T4.0 board with Neopixels (RGB leds are great!), AX-12 servo driver logic, and a bunch of other goodies. I carried forward my Neopixel DMA drivers from a prior project, and they came right up.
I used Paul's HardwareSerial code to do the heavy lifting of setting up the UART, and then modified the UART settings to suit. I struggled with the AX-12 driver for weeks! Using a 'scope I could see the polls going to the servo and responses coming back. The DMA logic never seemed to get the last byte (the checksum byte - something I wanted!).
This morning I was re-reading the RT1060 processor manual (again!) and stumbled across an obscure reference that made me wonder if I should turn off the FIFO. I turned it off and Hey Presto! it started working...
It's made my day!
Code:
LPUART2_FIFO &= ~LPUART_FIFO_RXFE;
Longer version:
I've returned to working on a Teensy-based controller for my Trossen Hexapod robot. The servos use a 1Mb async TTL interface, faster than I wanted to handle with interrupts. I had gotten DMA working with a T3.5, but life intervened...
Over the summer I laid out a a T4.0 board with Neopixels (RGB leds are great!), AX-12 servo driver logic, and a bunch of other goodies. I carried forward my Neopixel DMA drivers from a prior project, and they came right up.
I used Paul's HardwareSerial code to do the heavy lifting of setting up the UART, and then modified the UART settings to suit. I struggled with the AX-12 driver for weeks! Using a 'scope I could see the polls going to the servo and responses coming back. The DMA logic never seemed to get the last byte (the checksum byte - something I wanted!).
This morning I was re-reading the RT1060 processor manual (again!) and stumbled across an obscure reference that made me wonder if I should turn off the FIFO. I turned it off and Hey Presto! it started working...
It's made my day!