Skip to content

boards: Support Teensy Micromod #88502

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Apr 11, 2025

The Sparkfun Teensy Micromod was designed by Paul of PJRC and manufactured and sold by Sparkfun.com

Note: Earlier I created an Issue about this, which was then converted to a discussion
#88210

The functionality of this board is very similar to the Teensy 4. It has the same basic pin definitions of the Teensy 4 but added 6 additional IO pins. Which added a lot of possibilities to use the flexio system in new ways, such as for camera input.

It was unclear if the board should be added here or all of this duplicated under Sparkfun, but now Sparkfun is also now responsible for the manufacturing and sales of the Teensy 4 and Teensy 4.1, here feels like a good place.

Note: I am mainly doing this as a learning experience on how to use zephyr directly, as most of my experiences with Zephyr is done through the current WIP Arduino Wrappers for some of their boards.

So far I duplicated the Teensy 4.1 files, then modified, like removed the ethernet and added the I2C2 object. I updated the flash information as these come with a 128mbit version versus the 64 on T4.1 or 16 on T4.

So far I have only test blink.

@KurtE KurtE force-pushed the teensy_micromod branch 3 times, most recently from e3b5e19 to feb9331 Compare April 11, 2025 22:16
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2020, Bernhard Kraemer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowercase filename

# SPDX-License-Identifier: Apache-2.0
#

identifier: teensyMM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
identifier: teensyMM
identifier: teensymm

and filename to lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the files as I mentioned for earlier review plus the teensyMM -> teensymm

CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_GPIO=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000 should come from DTS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not done this one yet as this is a direct copy of the Teensy 41 defconf file
So have been trying to be consistent.

There are parts of the current configs that I don't fully understand why. Example, it shows support for the SDCard (SDIO) for the Teensy 4.1, but not the Teensy 4, yet the T4 can support it through the connector on the bottom
of the board.

Will look at this more

Copy link
Collaborator

@josuah josuah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the Sparkfun Teensy Micromod is having a completely different pinout than the PRJC classic Teensy boards:

https://cdn.sparkfun.com/assets/5/a/3/6/0/MicroMod-Teensy_V1_3.pdf
https://learn.sparkfun.com/tutorials/designing-with-micromod/all#pin-specifications

Could you confirm which pinout you are documenting here?

As an alternative from the "teensy", you can also aim for the "boards/sparkfun/micromod" board as a directory as it is a SparkFun-made board.

Thank you for extending the MicroMod collection!

@KurtE
Copy link
Contributor Author

KurtE commented Apr 14, 2025

It seems like the Sparkfun Teensy Micromod is having a completely different pinout than the PRJC classic Teensy boards:

I guess it depends on what we mean by pinout.
The pinout I am showing is the Teensy Arduino programming model for these boards.

That is, if you buy one of these boards, you are directed to install the Teensy boards through the Arduino
board manager (assuming Arduino 2.x) for 1.x you install using Teensyduino.

The pin numbers shown are the ones defined in cores/teensy4. They match the pins for the T4 with 6 pins added at the
end.

We could additionally show the Micromod pin numbers as well if desired. Like I could show the complete list for
the MMOD and add column with the MMOD pin number. I have all of that stuff in my Excel documents I created
when helping to add support for it when it was in alpha/beta mode.

As an alternative from the "teensy", you can also aim for the "boards/sparkfun/micromod" board as a directory as it is a SparkFun-made board.

That is a possibility. Although it gets confusing these days.

As I mentioned: From a recent blog on PJRC

SparkFun To Manufacture Teensy
We are excited to announce the expansion of our partnership with SparkFun Electronics to include the manufacturing of all Teensy products. Teensy 4.0, Teensy 4.1 and related accessories will now be manufactured by SparkFun in Colorado, USA.

SparkFun will also fulfill direct sales and also sell to other distributors, so you can continue to buy from stores which currently carry Teensy.

With Pin numbering/naming wondering if maybe from a current conversation on the Arduino Zephyr porting. Where one
suggestion was to explot the Zephyr GPIO nexus nodes abstraction. Don't know enough about that yet.
Right now playing along with some Arduino people on how to handle the pin numbering/naming on the Portenta H7 port/wrapping for zephyr.

@KurtE KurtE force-pushed the teensy_micromod branch 2 times, most recently from 857e96f to 4e32710 Compare April 15, 2025 02:09
@KurtE
Copy link
Contributor Author

KurtE commented Apr 15, 2025

Note: I pushed up a new copy of the index.rst, which duplicates the MMOD pin mappings and it includes
the actual MicroMod pin numbers as well. Let me know what you think

@josuah
Copy link
Collaborator

josuah commented Apr 15, 2025

Just to summarize the different pin naming used.

Teensy doc (PCB pin number)

SparkFun doc (using Arduino IDE names, PCB pin numbers of the original Teensy, and micromod pin number)

scrot_20250415_161739_393x560

NXP doc (final chip numbers)

scrot_20250415_161954_176x163

Here, this is turned into a teensy board: the pinout matches names of another PCB, given by SparkFun for backward compatibility purpose. It can become tedious to make the teensy pin numbers the standard while the pinout of the board is the MicroMod standard. Willing to try turning this into a MicroMod? :) This might really not be as hard as it sounds.

Links that helped me:

@josuah
Copy link
Collaborator

josuah commented Apr 15, 2025

Every vendor has a different way to specify GPIO pins, sometimes it is <0 3 &gpioa 21>, sometimes it is <&gpio0 25>... A "mapping" or "nexus" helps vendor-neutralizing this all.

micromod_header: connector {
compatible = "sparkfun,micromod-gpio";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &gpio0 4 0>, /* A0 */
<1 0 &gpio0 5 0>, /* A1 */
<2 0 &gpio0 27 0>, /* D0 */
<3 0 &gpio1 8 0>, /* D1/CAM_TRIG */
<4 0 &gpio0 15 0>, /* I2C_INT# */
<5 0 &gpio0 29 0>, /* G0/BUS0 */
<6 0 &gpio0 3 0>, /* G1/BUS1 */
<7 0 &gpio1 13 0>, /* G2/BUS2 */
<8 0 &gpio1 12 0>, /* G3/BUS3 */
<9 0 &gpio1 11 0>, /* G4/BUS4 */
<10 0 &gpio0 17 0>, /* G5/BUS5 */
<11 0 &gpio1 6 0>, /* G6/BUS6 */
<12 0 &gpio1 4 0>, /* G7/BUS7 */
<13 0 &gpio1 14 0>, /* G8 */
<14 0 &gpio0 9 0>, /* G9/ADC_D-/CAM_HSYNC */
<15 0 &gpio0 10 0>, /* G10/ADC_D+/CAM_VSYNC */
//<16 NO CONNECTED /* G11/SWO */
<17 0 &gpio0 20 0>; /* SPI_CS */
};

Once this is done, it becomes possible to use new names like <&micromod_header 7 0>: micromod pin numbers... and that's it, we are done! You can then use it with --shield sparkfun_carrier_asset_tracker and all other carrier boards defined in the future.

Further reading:

Copy link
Collaborator

@josuah josuah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GPIO nexus probably does not need to be added on this PR though...

In addition to what @nordicjm pointed at (thank you!) I only spotted one small detail that needs at least a comment on the README.rst, or be removed to avoid dealing with it on this PR.

Besides this, LGTM thank you!

@KurtE KurtE force-pushed the teensy_micromod branch from db6532f to 050d25c Compare April 17, 2025 12:14
@KurtE KurtE marked this pull request as ready for review April 17, 2025 13:24
@github-actions github-actions bot added the area: Samples Samples label Apr 17, 2025
@github-actions github-actions bot requested review from kartben and nashif April 17, 2025 13:25
josuah
josuah previously approved these changes Apr 17, 2025
@kartben kartben force-pushed the teensy_micromod branch 2 times, most recently from c2f913f to 367a281 Compare April 17, 2025 14:14
@github-actions github-actions bot added the area: Input Input Subsystem and Drivers label Apr 17, 2025
@github-actions github-actions bot requested a review from fabiobaltieri April 17, 2025 14:15
kartben
kartben previously approved these changes Apr 17, 2025
Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just pushed some minor doc fixups (including using transparent image and not the weird screenshot that was there initially)

also dropped the unrelated change you had made to blinky :)

@kartben kartben removed the area: Input Input Subsystem and Drivers label Apr 17, 2025
@kartben kartben requested review from josuah and nordicjm April 17, 2025 16:19
kartben
kartben previously approved these changes Apr 22, 2025
josuah
josuah previously approved these changes Apr 22, 2025
@kartben kartben requested a review from nordicjm April 24, 2025 09:37
Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compliance errors need resolving also

Comment on lines +48 to +49
/* WINBOND flash memory*/
w25q128jvxgim: w25q128jvxgim@0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry not sure what you mean by newline? do you mean I should add a blank line or
was there a windows cr/lf...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline so that there is a newline e.g.:

	reg = <0x402a8000 0x4000>, <0x60000000 DT_SIZE_M(8)>;

	/* WINBOND flash memory*/
	w25q128jvxgim: w25q128jvxgim@0 {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pushed up the change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops pushed again. I see editor insterted tabs to align it... removed

ignore_tags:
- net
- posix
vendor: nxp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't right, nxp doesn't create teensy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed that to sparkfun as they are the one who sells it.
Note: I did not update the Teensy 4 or 4.1 versions which also have nxp.

@KurtE KurtE dismissed stale reviews from josuah and kartben via 47d3e09 April 24, 2025 13:15
@KurtE KurtE force-pushed the teensy_micromod branch 3 times, most recently from 7f71a8a to 9385932 Compare April 24, 2025 14:22
@KurtE
Copy link
Contributor Author

KurtE commented Apr 26, 2025

@nordicjm @josuah - Not sure what the twister builds are doing?

Is there something I need to change/do to make these work?

Thanks for all of your help

@josuah
Copy link
Collaborator

josuah commented Apr 27, 2025

@KurtE It seems like the job that failed is unrelated to the board you added.
In such case, rebasing your branch on top of latest main might be enough to fix it.

Thank you for the efforts!

@KurtE KurtE force-pushed the teensy_micromod branch from 9385932 to 70ae8c1 Compare April 27, 2025 13:23
@KurtE
Copy link
Contributor Author

KurtE commented Apr 27, 2025

In such case, rebasing your branch on top of latest main might be enough to fix it.
Thanks, did the trick

@josuah josuah self-requested a review April 27, 2025 13:58
@josuah
Copy link
Collaborator

josuah commented Apr 28, 2025

Closing-reopening to retrigger CI
scrot_20250428_173105_764x219

@josuah josuah closed this Apr 28, 2025
@josuah josuah reopened this Apr 28, 2025
@KurtE
Copy link
Contributor Author

KurtE commented Apr 30, 2025

@josuah @nordicjm - looks like some twister issues. Where if I am reading this correct, the SD test is failing:

west build -p -b teensymm/mimxrt1062 samples/subsys/fs/fs_sample -T sample.filesystem.fat_fs

Again, sorry I am still getting my feet wet with this system!

That test does build for teensy41 and also fails on teensy40.

My wild guess is that maybe the failure is due to me having stuff in it .yaml file:

identifier: teensymm
name: PJRC TEENSY_MICROMOD
type: mcu
arch: arm
toolchain:
  - zephyr
  - gnuarmemb
  - xtools
ram: 768
flash: 8192
supported:
  - counter
  - gpio
  - sdhc
  - usb_device
  - netif:eth
testing:
  ignore_tags:
    - net
    - posix
vendor: sparkfun

I believe I should remove the netif:eth as that is not in the teensy40.yaml file, which makes sense as only the
T41 has the added support for Ethernet.

But: I still wondering about - sdhc
line, as it is not in T40 either, but is on T41. The main difference is that T4.1 has the SD adapter soldered
onto the Board itself, the Teensy 40 has pads on the bottom of the board:
image
On the Micromod, the pins are on the main main micromod connector: like everything else, gpio, usb, ...

Suggestions: I am thinking I might try removing those two defines? Or should I try adding it
to the ignore_tags ?

Note: I have tried the SD out on a couple of different MMod adapter boards. I believe I showed a few of them.
Here are three of them I use for most things with Teensy MMOD:
image

EDIT: picture was pasted upside down so editing top to bottom...
Bottom one is again ATP board with my own adapter to make things easier. Like test of my ILI9341 code running on
zephyr. Middle one is one I had a few partially assembled (all of the small pad components). and the top one
is the original one Paul of PJRC made while the Teensy MMOD was in beta. Note: Currently I can not use this one for
Zephyr as it is a locked Teensy, which can not be programmed using teensy_loader_cli.

Thanks again for all of your help

@josuah
Copy link
Collaborator

josuah commented Apr 30, 2025

I would propose testing with the twister command: the build flags are very slightly different.

west twister -p teensymm/mimxrt1062 -s sample.filesystem.fat_fs --no-detailed-test-id

try removing those two defines? Or should I try adding it to the ignore_tags?

Maybe it would work to introduce everything except the SD card support, to allow merging this and work on troubleshooting it later if that makes things easier.

@KurtE
Copy link
Contributor Author

KurtE commented Apr 30, 2025

Thanks, I tried that version of command line and it did not appear to work for MM nor 41...

I will try the changes that I mentioned and see if that helps.
Note: with my SD Test sketch it is still able to build and run and list the contents of the SD Card in my ATP adapter

The Sparkfun Teensy Micromod was designed by Paul of PJRC
and manufactured and sold by Sparkfun.com

The functionality of this board is very similar to the Teensy 4.

It has the same basic pin definitions of the Teensy 4 but added
6 additional IO pins. Which added a lot of possibilities to use
the flexio system in new ways, such as for camera input.

It was unclear if the board should be added here or all of this
duplicated under Sparkfun, but now Sparkfun is also now responsible for
 the manufacturing and sales of the Teensy 4 and Teensy 4.1, here feels
 like a good place.

Note: I am mainly doing this as a learning experience on how to use
zephyr directly, as most of my experiences with Zephyr is done through
the current WIP Arduino Wrappers for some of their boards.

So far I duplicated the Teensy 4.1 files, then modified, like removed
the Ethernet and added the I2C2 object.

I updated the flash information as these come with a 128mbit version
versus the 64 on T4.1 or 16 on T4.

So far I have only test blink.
plus: cdc-acm example, plus adding gpio to it,
plus logging, plus blinking.

Signed-off-by: Kurt Eckhardt <[email protected]>
@KurtE KurtE force-pushed the teensy_micromod branch from 002fef4 to 16e0ada Compare April 30, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants