LXTeensy3DMX_Library for teensy 4.0

LXSeries open source projects are hosted on github.
Post Reply
bvanpoortvliet
Posts: 5
Joined: Wed Jan 29, 2020 7:20 pm
Location: The Netherlands

LXTeensy3DMX_Library for teensy 4.0

Post by bvanpoortvliet »

Hi,

I am trying to build a Artnet node with the LXTeensy3DMX_Library. And whilst the Teensy3ArtNetSACN2Universes_rdm.ino example works perfectly straight out of the box on a teensy 3.2 I would like to make use of the power and extra serial ports on the teensy 4.0.

However, because the libraries are written for the teensy 3.x it won't compile on teensy 4.0. At the moment I am running into the following error:
/Users/xxx/Documents/Arduino/libraries/LXTeensy3DMX_Library/src/LXTeensy3DMX.h:62:21: fatal error: kinetis.h: No such file or directory
compilation terminated.
I saw that LXTeensy3DMX.h and LXTeensy3DMX_common.h include kinetis.h but I guess this is a teensy 3.x specific file since its part of the teensy3 core folder.

This made me realize that the library needs to be ported to the teensy 4.0 architecture, but since I have no clue on how to achieve this I am wondering if you guys could give me some pointers on how to do this.


Any help would be very much appreciated!

Ps. If you manage to port it for me, I will buy you a beer


Cheers!
build.destroy.repeat
admin
Site Admin
Posts: 1643
Joined: Mon Nov 05, 2007 1:26 am
Contact:

Post by admin »

The processors in the Teensy 3.2 and Teensy 4 are completely different even though the pins are very compatible between the two. It will take a while to adapt the library to the different processor. Its likely to be similar but all the macro definitions found in the kinetis.h file will need to be replaced with the corresponding ones for the Teensy 4.

I have ordered a Teensy 4 and will work on releasing a new library once it arrives. Its hard to say how difficult that will be or how long it will take to get it functional. I will create a repo on github for the project so that it is available for you to experiment with.
bvanpoortvliet
Posts: 5
Joined: Wed Jan 29, 2020 7:20 pm
Location: The Netherlands

Post by bvanpoortvliet »

Wow! So great to hear you're willing to do that! Is there anything I can do to contribute meanwhile?
build.destroy.repeat
admin
Site Admin
Posts: 1643
Joined: Mon Nov 05, 2007 1:26 am
Contact:

Post by admin »

There is a first draft of a Teensy4 DMX driver on github:

https://github.com/claudeheintz/LXTeens ... ibrary.git

The DMX output works. Input and RDM are untested as of today.
bvanpoortvliet
Posts: 5
Joined: Wed Jan 29, 2020 7:20 pm
Location: The Netherlands

Post by bvanpoortvliet »

Whoa that was fast, thanks so much! I've tested it yesterday and it works great. I did notice that the second universe outputs on TX3 instead of TX2, is there any way for me to map it? Also, are you planning to include all the serial ports?


Thanks again!
build.destroy.repeat
admin
Site Admin
Posts: 1643
Joined: Mon Nov 05, 2007 1:26 am
Contact:

Post by admin »

On Teensy 3.x RX2/TX2 are pins 9 and 10 and RX3/TX3 are pins 7 and 8.

Initially LXTeensy4DMX2 matched LXTeensy3DMX2 which used RX3/TX3 on pins 7 and 8. However, this is now labeled RX2/TX2 on the "Welcome to Teensy 4.0" pin diagram card.

So, this is now switched so that:

LXTeensy4DMX is used with the following global objects:
Teensy4DMX uses pins 0 and 1 RX1/TX1
Teensy4DMX1 uses pins 7 and 8 RX2/TX2
Teensy4DMX2 uses pins 15 and 14 RX3/TX3
bvanpoortvliet
Posts: 5
Joined: Wed Jan 29, 2020 7:20 pm
Location: The Netherlands

Post by bvanpoortvliet »

Excuse me for my late reply, I've been out of office for a bit. Thanks again for your hard work. I did not test all the universes because of the aformentioned lack of time.

I was wondering, is there a way to make use of all the RX/TX pins at once? I'd really like to use RX/TX 1 to 7 at the same time as I'm pretty certain the processor can handle it.

Would this be as simple as copying LXTeensy4DMX3.cpp and .h to LXTeensy4DMX4.cpp and .h and declaring pin 21 and 22 for example?

Furthermore, is there anything I can do to contribute?


Cheers, and thanks again :D
build.destroy.repeat
admin
Site Admin
Posts: 1643
Joined: Mon Nov 05, 2007 1:26 am
Contact:

Post by admin »

There are now LXTeensy4DMX objects for all 7 of the UARTs. There is now a summary at the end of the LXTeensy4DMX.h file of the hardware configuration for each one. This information is taken from the Teensy4 hardware definitions for HardwareSerial1 through HardwareSerial7.

Its pretty straightforward as far as the pointer to the UART's registers and configuring the clocking. The registers related to pin configuration are somewhat complex and I haven't been able to completely figure them out for myself. So, for that part, I'm relying on what I found in the Teensyduino /cores files. I'm not sure about the pin configuration for HardwareSerial5 because it looks different (LXTeensy4DMX4). But, it seems to work.
bvanpoortvliet
Posts: 5
Joined: Wed Jan 29, 2020 7:20 pm
Location: The Netherlands

Post by bvanpoortvliet »

This is great, I will do some testing soon and post my findings!
build.destroy.repeat
Post Reply