Thor/ubuntu method to use Jetson_Thor_Series_Modules_Pinmux_Template & generate dtsi

Thor ubuntu method to use Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm

If you don’t have LibreOffice Calc install it
sudo apt update && sudo apt install libreoffice-calc # or just “libreoffice” (for entire suite).

Save attached *.txt to a directory dropping the .txt suffix from the name.

gen_pinmux_dt_from_xlsx.py.txt (8.1 KB)

pinmux_dtsi_delta.py.txt (3.2 KB)

Download Jetson_Thor_Series_Modules_Pinmux_Template.xlsm

  1. Open Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm in LibreOffice Calc
  2. Go to Tools/Options. click ‘Macro Security’ click ‘Trusted Sources’ tab.
  3. Under ‘Trusted File Locations’
    ‘Add’ the directory where you put Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm
  4. Exit Calc.

pip install pandas openpyxl

# 1. Generate full dtsi before
python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-Before.dtsi

In Calc make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"

# 2. Generate after dtsi
python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-After.dtsi

# 3. Produce your delta .dtsi with the required changed pins
python3 pinmux_dtsi_delta.py pinmux-thor-Before.dtsi pinmux-thor-After.dtsi -o pinmux-thor-Delta.dtsi
2 Likes

Hi whitesscott,

We’ve not verified using pinmux spreadsheet on linux host.
Thank you for sharing the python script on the forum.
It’s helpful for the people with this requirement.

1 Like

Hi whitesscott,

I just run the python script you shared and it would result the following messages.

$ python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-Before.dtsi
Wrote pinmux-thor.dtsi with 0 pin blocks.

It seems the data of Column C and AS cannot be retrieved correctly.

Hi KevinFFF

I just followed this on my Thor. Saving the xlsm file after making modifications. Then closing LibreOffice Calc. Ignoring the macro errors as we’re not using the excel vba macros.

renamed attachment to *.txt

pinmux-thor-Delta.dtsi.txt (872 Bytes)

- Open **Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm** with **LibreOffice Calc**.
- Go to **Tools → Options** → **LibreOffice → Security** → click **Macro Security** → select the **Trusted Sources** tab.
- Under **Trusted File Locations**, click **Add**, then select the directory where you saved `Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm`.
- Exit LibreOffice Calc.

pip install pandas openpyxl

# 1. Generate base dtsi.
python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-Before.dtsi

# 2. In Calc make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"

# 3. Generate after dtsi 
python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-After.dtsi

# 4. Produce a delta .dtsi with the required changed pins
python3 pinmux_dtsi_delta.py pinmux-thor-Before.dtsi pinmux-thor-After.dtsi -o pinmux-thor-Delta.dtsi

I’ve referred your steps again but I still get the similar result(i.e. Wrote pinmux-thor.dtsi with 0 pin blocks.)

Do you get the following error in LibreOffice Calc?

What’s Ubuntu version you are using?

Okay, it seems the issue is caused from the Ubuntu version.
I can run it successfully with Ubuntu 22.04 as following but not for 18.04.

$ python3 gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template.xlsm -o pinmux-thor-Before.dtsi
Wrote pinmux-thor-Before.dtsi with 445 pin blocks.

It seems the method you shared is to compare the difference before and after the modification.
The generated pinmux dtsi from your script is much different from generated on Windows.
e.g. PWM1 and CAN0_DOUT
image

by your script:

			GP30_PWM1 {
				nvidia,pins = "GP30_PWM1";
				nvidia,function = "GP_PWM1";
				nvidia,pull = <0>;
				nvidia,tristate = <0>;
				nvidia,enable-input = <0>;
				nvidia,drv-type = <0>;
			};
..
			GP200_CAN0_DOUT {
				nvidia,pins = "GP200_CAN0_DOUT";
				nvidia,function = "CAN0_DOUT";
				nvidia,pull = <0>;
				nvidia,tristate = <0>;
				nvidia,enable-input = <0>;
				nvidia,drv-type = <0>;
			};

by Excel on Windows:

			pwm1_pa0 {
				nvidia,pins = "pwm1_pa0";
				nvidia,function = "gp_pwm1";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};
..
			can0_dout_pab0 {
				nvidia,pins = "can0_dout_pab0";
				nvidia,function = "can0_dout";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_DEFAULT_DRIVE_1X>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

I’m running this on my Thor, Ubuntu24.04. I just modified instructions and followed it doing nothing but what follows. Did not click anything but in the spreadsheet to modify the pins.


A way to use Jetson Pinmux Template on Linux with out needing to use Microsoft Excel.

Download a new Jetson_Thor_Series_Modules_Pinmux_Template.xlsm from

https://developer.nvidia.com/downloads/assets/embedded/secure/jetson/thor/docs/Jetson_Thor_Series_Modules_Pinmux_Template.xlsm

Install requirments.

pip install pandas openpyxl

Copy the three files to an empty directory.

cp ~/Downloads/Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm ~/emptyDir
cp *.py ~/emptyDir

Then

# 1. Generate base dtsi.
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-Before.dtsi

# 2. Doubleclick Pinmux xlsm to open in Calc. Make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"
Exit LibreOffice.

# 3. Generate after dtsi 
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o pinmux-thor-After.dtsi

# 4. Produce a delta .dtsi with the required changed pins
python pinmux_dtsi_delta.py pinmux-thor-Before.dtsi pinmux-thor-After.dtsi -o pinmux-thor-Delta.dtsi

# 5. Implement pinmux-thor-Delta.dtsi

pinmux-thor-Delta.dtsi.txt (3.2 KB)

I will attempt to modify the python to work. I had not tested the spreadsheet with Excel on Windows.

Thank you

Create dts{i} using Jetson Pinmux Template on Linux with out Microsoft Excel.

Download a new Jetson_Thor_Series_Modules_Pinmux_Template.xlsm from

https://developer.nvidia.com/downloads/assets/embedded/secure/jetson/thor/docs/Jetson_Thor_Series_Modules_Pinmux_Template.xlsm

Install requirements.

pip install pandas openpyxl

Copy the three files to any empty directory.

cp ~/Downloads/Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm ~/emptyDir
cp *.py ~/emptyDir

Then

# 1. Generate base dtsi.
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o Before.dtsi

# 2. Double-click Pinmux xlsm to open in Calc. Make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"
Exit LibreOffice.

# 3. Generate after dtsi 
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o After.dtsi

# 4. Produce a delta .dtsi with the required changed pins
python Pinmux_dtsi_delta.py Before.dtsi After.dtsi -o pinmux-thor-Delta.dtsi

Pinmux_dtsi_delta.py.txt (5.8 KB)

gen_pinmux_dt_from_xlsx.py.txt (16.6 KB)

@KevinFFF Please don’t test yet, if you were going to. I found some more to improve. Thanks

Thanks for your notification.
Please let me know when it has been done and I can help to verify locally.

@KevinFFF

gen_pinmux_dt_from_xlsx.py.txt (11.8 KB)

Pinmux_dtsi_delta.py.txt (5.8 KB)

pinmux_validator.py.txt (9.8 KB)

Create dts{i} using Jetson Pinmux Template on Linux without Microsoft Excel.

mkdir ~/dts && cd dts

Download a fresh Jetson_Thor_Series_Modules_Pinmux_Template.xlsm

wget https://developer.nvidia.com/downloads/assets/embedded/secure/jetson/thor/docs/Jetson_Thor_Series_Modules_Pinmux_Template.xlsm

Install requirments.

pip install pandas openpyxl

Copy the four files to an directory, or ~/dts

Download the attached *.txt and remove .txt suffix
cp *.py ~/dts

Then

# 1. Generate base / before dtsi.
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o Before.dtsi

# 2. Doubleclick Pinmux xlsm to open in Calc. 
Make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"
Exit LibreOffice.

# 3. Generate after dtsi
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o After.dtsi

# 4. Produce a delta .dtsi with the your required changed pins
python Pinmux_dtsi_delta.py Before.dtsi After.dtsi -o Delta.dtsi

Hi whitesscott,

Thank you for updating the python script.

Some attributes you generated are still different from the one generated from Excel on Windows.

by your script:

			pwm6_pa1 {
				nvidia,pins = "pwm6_pa1";
				nvidia,function = "gp_pwm6";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
			};
..
			pex_l5_rst_n_pd3 {
				nvidia,pins = "pex_l5_rst_n_pd3";
				nvidia,function = "pe5_rst_l";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,lock = <TEGRA_PIN_ENABLE>;
			};

by Excel on Windows:

			pwm6_pa1 {
				nvidia,pins = "pwm6_pa1";
				nvidia,function = "gp_pwm6";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};
..
			pex_l5_rst_n_pd3 {
				nvidia,pins = "pex_l5_rst_n_pd3";
				nvidia,function = "pe5_rst_l";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

and there’re no the following lines in your pinmux dtsi.

#include "t264-pinctrl-tegra.h"

#include "./Thor-jetson thor_devkit-gpio-default.dtsi"

pinmux@ac281000 {

So the generated pinmux dtsi may not be used correctly by MB1.

@KevinFFF Dug into vba and an old vba book and following seems to work. Same workflow. Download attached to same directory as the *.xslm.

# 1. Generate base dtsi.
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o Before.dtsi

# 2. Doubleclick Pinmux xlsm to open in Calc. Make your edits to Jetson_Thor_Series_Modules_Pinmux_Template.xlsm
Click Save, Click bottom right box titled "Use Excel 2007-365 (macro-enabled) Format"
Exit LibreOffice.

# 3. Generate after dtsi
python gen_pinmux_dt_from_xlsx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4.xlsm -o After.dtsi

# 4. Produce a delta .dtsi with the required changed pins
python Pinmux_dtsi_delta.py Before.dtsi After.dtsi -o Delta.dtsi

gen_pinmux_dt_from_xlsx.py.txt (12.4 KB)

safe_function_logic.py.txt (2.5 KB)

Pinmux_dtsi_delta.py.txt (8.2 KB)

pinmux_configbits.py.txt (8.5 KB)

Edit: 11/22/25 9:36pm. Updated pinmux_validator.py to implement vba FunctionToCheckPinDirection
”Functions to check that the pin direction selected matches the customer usage”

pinmux_validator.py.txt (10.4 KB)

@whitesscott thank you for looking in to this. Really wanted feature to not be bound to Windows.

I have tested this on my modified pinmux sheet and get in to this error:

$ python gen_pinmux_dt_from_xslx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4_.xlsm -o pinmux-1.4-after.dtsi
Warning: safe_function_logic not found. Defaulting to simple fallback.
Traceback (most recent call last):
  File "/home/pbergin/thor/pinmux/gen_pinmux_dt_from_xslx.py", line 375, in <module>
    main()
  File "/home/pbergin/thor/pinmux/gen_pinmux_dt_from_xslx.py", line 360, in main
    wb = load_workbook(args.excel, data_only=True)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/reader/excel.py", line 346, in load_workbook
    reader.read()
  File "/usr/lib/python3/dist-packages/openpyxl/reader/excel.py", line 299, in read
    apply_stylesheet(self.archive, self.wb)
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 198, in apply_stylesheet
    stylesheet = Stylesheet.from_tree(node)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 103, in from_tree
    return super(Stylesheet, cls).from_tree(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/descriptors/serialisable.py", line 103, in from_tree
    return cls(**attrib)
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 94, in __init__
    self.named_styles = self._merge_named_styles()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 114, in _merge_named_styles
    self._expand_named_style(style)
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 124, in _expand_named_style
    xf = self.cellStyleXfs[named_style.xfId]
         ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/cell_style.py", line 185, in __getitem__
    return self.xf[idx]
           ~~~~~~~^^^^^
IndexError: list index out of range

Anything you’ve seen? Tips to debug?

Does safe_function_logic.py.txt exist as *.py in same directory?

It was not but I fixed that and the error remains.

$ python gen_pinmux_dt_from_xslx.py Jetson_Thor_Series_Modules_Pinmux_Template_v1.4_.xlsm -o pinmux-1.4-after.dtsi
Traceback (most recent call last):
  File "/home/pbergin/thor/pinmux/gen_pinmux_dt_from_xslx.py", line 375, in <module>
    main()
  File "/home/pbergin/thor/pinmux/gen_pinmux_dt_from_xslx.py", line 360, in main
    wb = load_workbook(args.excel, data_only=True)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/reader/excel.py", line 346, in load_workbook
    reader.read()
  File "/usr/lib/python3/dist-packages/openpyxl/reader/excel.py", line 299, in read
    apply_stylesheet(self.archive, self.wb)
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 198, in apply_stylesheet
    stylesheet = Stylesheet.from_tree(node)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 103, in from_tree
    return super(Stylesheet, cls).from_tree(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/descriptors/serialisable.py", line 103, in from_tree
    return cls(**attrib)
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 94, in __init__
    self.named_styles = self._merge_named_styles()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 114, in _merge_named_styles
    self._expand_named_style(style)
  File "/usr/lib/python3/dist-packages/openpyxl/styles/stylesheet.py", line 124, in _expand_named_style
    xf = self.cellStyleXfs[named_style.xfId]
         ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/openpyxl/styles/cell_style.py", line 185, in __getitem__
    return self.xf[idx]
           ~~~~~~~^^^^^
IndexError: list index out of range

Thank you for testing. Following might matter. It’s a difference that comes to mind seeing that your version is in dist-packages.

Create and activate a venv.

pip install openpyxl

That will install openpyxl==3.1.5
The version installed with apt is python3-openpyxl 3.1.2

Then retry before/after/delta.

1 Like

@whitesscott with openpyxl version 3.1.5 it worked to generate output and I get no error. Thanks!

1 Like

@KevinFFF If interested, I believe the last version may work. 11/20/25