Looking for Teensyduino definition of extensions/resources added to Arduino IDE

MarkED

New member
I am sorry to bother the forum members, but I have literally spent hours searching the website and forums, and have come up empty.

I am using Teensy 4.1.

I have successfully installed Teensy into Arduino IDE (which I have used for several small projects).

I did find the MIDI functions list added, such as sendNoteOn.

What I am after would contain info like the following - all of which I would consider extensions/resources you have added and are contained in you Teensy library.

Teensy 4.1 regs (RT1060) you support (I know you support GPIO6 as I have used this reg following an example program by David Zmick ==>
Code:
https://dpzmick.com/posts/2021-10-26-teensy-4.1-set-many-pins.html

Do you support the Teensy 4.1 GPIO input pullup values (ex. pinMode (0, INPUT_PULLUP_XXX), where XXX is one of the RT1060 supported values)? What is the default PULLUP resistor value you get using pinMode of INPUT_PULLUP?

GPIO to Teensy 4.1 IO pin assignments (ex: GPIO1 bits 0 to 15 are connected to Teensy 4.1 board pins 0 to 15???)

I think this gives you the flavor of what I am after. Hopefully I just haven't found the right webpage on the site, and you can just post a website.

For the project I am just in the planning phase for, I will mainly be using 8 outputs and 24 inputs. Outputs to control multiplexing, inputs to receive multiplexed busses. Have old Yamaha organ with keyboard/pedals that use the switch matrix with diodes, and want to use keyboard/pedals through Teensy 4.1 to create MIDI via USB to PC running Miditzer Pipe Organ Simulator.

Thanks in advance for your time and consideration.

Mark
 
I am not sure there is everything you mentioned all in one place, but for example what pins do you what:
If you look at thteT4.1 product page: https://www.pjrc.com/store/teensy41.html
You will see it showing the card, and then a link to a additional information about my pinout chart. (Excel document) which takes
you to this page: https://forum.pjrc.com/index.php?th...i-connect-to-use-third-spi.66144/#post-268934
Which looks like:
1742843012148.png

Only show part of it here... But for GPIO column it shows like Pin 2 is Port 4 Pin 4.
Note: I am showing the standard mode GPIO ports, the Teensy typically runs in High-speed mode on all of the pins.
So add 5 to the port number: so it is Port 9 pin 4...

In my spreadsheet I do have a page where I keep it sorted in GPIO pin order...
1742843321890.png

Do you support the Teensy 4.1 GPIO input pullup values (ex. pinMode (0, INPUT_PULLUP_XXX), where XXX is one of the RT1060 supported values)? What is the default PULLUP resistor value you get using pinMode of INPUT_PULLUP?
I don't believe so. It does support INPUT_PULLUP. As for what value it is or similar questions. it is easiest to look at the codel
(cores/teensy4/digital.c)
Code:
} else if (mode == INPUT_PULLUP) {
            *(p->pad) = IOMUXC_PAD_DSE(7) | IOMUXC_PAD_PKE | IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(3) | IOMUXC_PAD_HYS;

And Reference Manual:
1742843806361.png
 
@KurtE thank you for the information!!!! I will have to do some simple code to experiment with the info to get a better understanding. Just to be clear, it appears that you are equating Port4 for GPIO4 - I didn't see Ports per say defined in the RT1060 reference manual.

I am a hardware guy, with enough code training to get myself into trouble. My desire to use Ports (GPIOs) is to try and keep the code run speed up. Turn on one of 8 multiplexer outputs, wait for inputs to settle (three 8 bit busses representing Solo Keyboard, Accom Keyboard, Pedals and stops), then exclusive or present bus value against saved prior bus value ==> 0 as result indicates no change of any of the 8 keys/pedals/stops. If not 0, do bit by bit compare to find what changed (only on the bus that indicates change). So if nothing has changed, polling would be reduced from 8 multiplexer setting times test each of the 8 individual input pins/bus times 3 busses equals 192 reads/compares ==> to 8 multiplexer setting times test each of each bus times 3 busses equals 24 reads/compares.
 
Sorry, I am using the word port in a generic term... When I say port for it is actually GPIO4...

One file in the cores\teensy4 which gives you all of the real specifics is the file: imxrt.h
Like we defined a structure for the GPIO registers:
Code:
// 12.5.1: page 961
typedef struct {
        volatile uint32_t DR;                  // 00
        volatile uint32_t GDIR;                // 04
        volatile uint32_t PSR;                 // 08
        volatile uint32_t ICR1;                // 0C
        volatile uint32_t ICR2;                // 10
        volatile uint32_t IMR;                 // 14
        volatile uint32_t ISR;                 // 18
        volatile uint32_t EDGE_SEL;            // 1C
        uint32_t          UNUSED[25];          // 20 - 83
        volatile uint32_t DR_SET;              // 84
        volatile uint32_t DR_CLEAR;            // 88
        volatile uint32_t DR_TOGGLE;           // 8C


} IMXRT_GPIO_t;
And defines for each of the GPIO objects like:
Code:
#define IMXRT_GPIO1        (*(IMXRT_GPIO_t *)IMXRT_GPIO1_ADDRESS)

My main point for mentioning some of this is that while my excel document shows GPIOs 1-5, for the most part you won't
use those. You will instead likely using GPIOs 6-9 which they map up to (except 5)...
You can actually set it pin by pin using some IOMUXC regusters. As for example:
IOMUXC_GPR_GPR26 - register, controls pins either on GPIO1 or GPIO6:
1743032147345.png

Again, by default the startup code sets these IOMUXC registers such that all of the GPIO pins run in higher speed.
The reason I left the excel document using the lower number, is because the reference manual uses the lower numbers, like:
1743032465644.png


When they are in the HIGHER number GPIO, they are faster. However there are times I might switch them back to the
normal speed. One is DMA to a pin...

Another is if I need/want faster Interrupts. If you look at Chapter3 at the interrupt summary: table 3-2,
You will see there are several Interrupts possible for GPIO1
And 2 for each of GPIO2-5.

However, only one (157) GPIOS6-9. So for example the code for: attachInterrupt(pin, ...) there is only one hardware interrupt for all of the pins
you might attach to this code. But you could use code to switch one or more pins back to lower number and then setup to interrupt on one
of the interrupts that is for example the top half of GPIO2, and less GPIOS and pins on them to look at.

As for scanning bits, you might look at the interrupt code for the attachInterrupt:
Code:
inline void irq_anyport(volatile uint32_t *gpio, voidFuncPtr *table)
{
    uint32_t status = gpio[ISR_INDEX] & gpio[IMR_INDEX];
    if (status) {
        gpio[ISR_INDEX] = status;
        while (status) {
            uint32_t index = __builtin_ctz(status);
            table[index]();
            status = status & ~(1 << index);
            //status = status & (status - 1);
        }
    }
}
Instead of scanning each bit to see if it is set, it uses the ctz (count leading zeros) instruction ...
 
Back
Top