Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teensy 3.2/3.1 support #25

Open
Synergyst opened this issue Dec 5, 2019 · 6 comments
Open

Teensy 3.2/3.1 support #25

Synergyst opened this issue Dec 5, 2019 · 6 comments

Comments

@Synergyst
Copy link

Hello,

I am curious about what would need to be done in order for me to add Teensy 3.2/3.1 support.
I have a Teensy 3.2 I can test with, which has the same underlying hardware as the 3.1 aside from the 3.1 being 3.3v-only.

Kind regards.

@mmarchetti
Copy link
Owner

Hi,

Thanks for the question/interest! The main thing that is needed is a board definition file that maps Arduino pin numbers to ARM ports/pins.

The way these were created for most boards was to install the board support into Arduino, then run the gen_pins.py script. It reads the .h files for all the installed board types from Arduino, and creates the .h files needed by DirectIO. Presumably you would need to install something like Teensyduino (https://www.pjrc.com/teensy/td_download.html) in order for this to work. You probably need that anyway in order to compile and upload the code to the board.

Alternatively, you could create the .h file yourself based on the published pin mappings, and place it in the include/boards/avr directory.

The last step for the correct file to be used is to identify what compiler flag is used when targeting that board. From the source, it appears to be TEENSYDUINO. That has to be added like the other AVR boards here: https://github.com/mmarchetti/DirectIO/blob/master/include/ports_avr.h#L250 so the correct include file will automatically be selected for DirectIO to use.

Ping me if you have any questions/issues with getting this working.

@mmarchetti
Copy link
Owner

Correction, that would likely need to be in one of the ARM board subdirectories depending on which architecture flag is set during compilation. That is referenced here:

https://github.com/mmarchetti/DirectIO/blob/master/include/ports.h#L25-L34

@Synergyst
Copy link
Author

image

I'm using Arduino IDE 1.8.10 on Windows.
Am I doing something wrong perhaps?

@mmarchetti
Copy link
Owner

To find the installed packages, it has to be run against the path where the installed libraries live, which should be \Users\<username>\AppData\Local\Arduino18.

@mmarchetti
Copy link
Owner

OK, I tried this myself and haven't gotten gen_pins.py to work. Seems teensyduino doesn't install like the other board packages, and doesn't declare pins the same way in the header files. Your best bet might be to define the pin mapping manually. You just need to establish which pin numbers correspond to which port/pin on the microcontroller.

@Synergyst
Copy link
Author

I was testing the library on the Teensy 3.2 to check if DirectIO compiled against the Teensy 3.x from a program I made for another AVR before I opened the issue.
I don't need the direly need the library currently, but I'll probably get to mapping the ports, testing and then publishing any changes here if I end up really needing it for the Teensy 3.2/3.1.

It works great for the original AVR projects I needed and used it for though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants