Skip to content

Conversation

@danieldegrasse
Copy link
Contributor

@danieldegrasse danieldegrasse commented Jan 14, 2022

Add initial script to generate pinctrl groups from MEX file for iMX.RT
parts. This script uses the files provided in MCUXpresso config tools offline data
(downloadable from MCUXpresso SDK builder), combined with a MEX configuration file (editable with MCUXpresso config tools),
to automatically generate pinctrl groups for a given board.

Pinctrl groups can be handcoded without the aid of this script, it is only made available to simplify generation of pinctrl groups for NXP boards.

@mmahadevan108
Copy link
Collaborator

Just to be sure, the output of this script is what is included in PR #132. Can you please confirm.

@danieldegrasse danieldegrasse force-pushed the pinctrl-cfg-script branch 2 times, most recently from cf61f6b to ea9138a Compare January 19, 2022 18:49
@danieldegrasse
Copy link
Contributor Author

@mmahadevan108, yes, and the board dtsi file included in the Zephyr PR is also generated by this script

@danieldegrasse danieldegrasse force-pushed the pinctrl-cfg-script branch 2 times, most recently from 0d470fb to 0704704 Compare January 21, 2022 00:49
Comment on lines 463 to 511
signal_name = pin.attrib.get('pin_signal')
signal = signal_map[signal_name]
if not signal:
print(f"Warning: Signal name {signal_name} not present in mapping")
# No way to find mux option
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

I was hitting a KeyError here for any signals not present in the signal map. I think this should be:

Suggested change
signal_name = pin.attrib.get('pin_signal')
signal = signal_map[signal_name]
if not signal:
print(f"Warning: Signal name {signal_name} not present in mapping")
# No way to find mux option
continue
signal_name = pin.attrib.get('pin_signal')
if signal_name not in signal_map:
print(f"Warning: Signal name {signal_name} not present in mapping")
# No way to find mux option
continue
signal = signal_map[signal_name]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this change in the latest push. Out of interest, what signal was causing a KeyError? Some signals require no configuration by the pinctrl driver, and so aren't placed in the signal mapping. I want to make sure this is one of those signals and that the pinctrl driver isn't missing the ability to configure some pins.

Copy link
Contributor

Choose a reason for hiding this comment

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

These are the pins I get warned about:

Warning: Signal name USB_OTG1_VBUS not present in mapping
Warning: Signal name USB_OTG1_DP not present in mapping
Warning: Signal name USB_OTG1_DN not present in mapping
Warning: Signal name USB_OTG1_CHD_B not present in mapping
Warning: Signal name XTALI not present in mapping
Warning: Signal name XTALO not present in mapping
Warning: Signal name DCDC_GND0 not present in mapping
Warning: Signal name DCDC_GND1 not present in mapping
Warning: Signal name DCDC_IN0 not present in mapping
Warning: Signal name DCDC_IN1 not present in mapping
Warning: Signal name DCDC_IN_Q not present in mapping
Warning: Signal name DCDC_LP0 not present in mapping
Warning: Signal name DCDC_LP1 not present in mapping
Warning: Signal name DCDC_PSWITCH not present in mapping
Warning: Signal name DCDC_SENSE not present in mapping
Warning: Signal name GPANAIO not present in mapping
Warning: Signal name NGND_KEL0 not present in mapping
Warning: Signal name NVCC_EMC0 not present in mapping
Warning: Signal name NVCC_EMC1 not present in mapping
Warning: Signal name NVCC_GPIO0 not present in mapping
Warning: Signal name NVCC_GPIO1 not present in mapping
Warning: Signal name NVCC_GPIO2 not present in mapping
Warning: Signal name NVCC_PLL not present in mapping
Warning: Signal name NVCC_SD0 not present in mapping
Warning: Signal name NVCC_SD1 not present in mapping
Warning: Signal name VDD_HIGH_CAP not present in mapping
Warning: Signal name VDD_HIGH_IN not present in mapping
Warning: Signal name VDD_SNVS_CAP not present in mapping
Warning: Signal name VDD_SNVS_IN not present in mapping
Warning: Signal name VDD_SOC_IN0 not present in mapping
Warning: Signal name VDD_SOC_IN1 not present in mapping
Warning: Signal name VDD_SOC_IN2 not present in mapping
Warning: Signal name VDD_SOC_IN3 not present in mapping
Warning: Signal name VDD_SOC_IN4 not present in mapping
Warning: Signal name VDD_SOC_IN5 not present in mapping
Warning: Signal name VDD_SOC_IN6 not present in mapping
Warning: Signal name VDD_SOC_IN7 not present in mapping
Warning: Signal name VDD_USB_CAP not present in mapping
Warning: Signal name VDD_SOC_IN8 not present in mapping
Warning: Signal name VDDA_ADC_3P3 not present in mapping
Warning: Signal name VSS1 not present in mapping
Warning: Signal name VSS2 not present in mapping
Warning: Signal name VSS3 not present in mapping
Warning: Signal name VSS0 not present in mapping
Warning: Signal name VSS4 not present in mapping
Warning: Signal name VSS5 not present in mapping
Warning: Signal name VSS6 not present in mapping
Warning: Signal name VSS7 not present in mapping
Warning: Signal name VSS8 not present in mapping
Warning: Signal name VSS9 not present in mapping
Warning: Signal name VSS10 not present in mapping
Warning: Signal name VSS11 not present in mapping
Warning: Signal name VSS12 not present in mapping
Warning: Signal name VSS13 not present in mapping
Warning: Signal name VSS14 not present in mapping
Warning: Signal name VSS15 not present in mapping
Warning: Signal name VSS16 not present in mapping
Warning: Signal name VSS17 not present in mapping
Warning: Signal name VSS18 not present in mapping
Warning: Signal name USB_OTG2_DN not present in mapping
Warning: Signal name USB_OTG2_DP not present in mapping
Warning: Signal name USB_OTG2_VBUS not present in mapping

I think these are all voltage/ special function pins that I don't expect to generate pincfg drivers but would appreciate a second set of eyes if you see anything odd here that should be generating a mapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those do all look like special function pins to me. I wouldn't worry about the warnings.

@danieldegrasse danieldegrasse force-pushed the pinctrl-cfg-script branch 3 times, most recently from 7c84f70 to f333cdb Compare March 25, 2022 21:50
@danieldegrasse danieldegrasse changed the title Add initial script to parse signal XML file for iMX.RT parts Add script to generate pin control headers and pin control groups for iMX RT parts Mar 25, 2022
@danieldegrasse
Copy link
Contributor Author

@dleach02 This PR should be good to merge now that the pin control PR in Zephyr has gone in.

@NickolasLapp
Copy link
Contributor

Two other things that I noticed on this PR, for example when trying to generate pinctrl for the RT1060-EVKB.
Command:

python3 rt_gen_dts.py --cfg-tool-root ~/Downloads/MIMXRT1060-EVKB_ConfigTools_data/processors /Users/[email protected]/Downloads/MIMXRT1060-EVKB_ConfigTools_data/boards/MIMXRT1060-EVKB/ksdk2_0/MIMXRT1060-EVKB.mex
file
  1. Had to change namespaces to: NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_1.9'}
  • The default (mex_configuration_10) didn't work for the mex file I downloaded for the EVKB. Not sure what the proper solution is here
  1. I had to manually copy over the signal configuration reference.
  • Inside the package MIMXRT1062DVL6A/signal_configuration.xml, rather than specifying the full signal configuration, it simply provides a reference: <reference file="MIMXRT1062CVJ5A/signal_configuration.xml"/>. When I ran the script by default, I would get an error that there were no pins specified in the signal map. I was able to resolve the issue by manually "following" the reference, rather copying the reference files pin specs over to the first file, and then the .dtsi was able to generate.

@danieldegrasse
Copy link
Contributor Author

Had to change namespaces to: NAMESPACES = {'mex' : 'http://mcuxpresso.nxp.com/XSD/mex_configuration_1.9'}

@NickolasLapp this is interesting. That namespace versioning number looks off (I'd expect that value to go up, not down). When I attempt a generation using the default MEX file for the EVKB, I don't have that issue (I've attached the file I used, as a ZIP). I created this file using the new file dialogue in MCUXpresso config tools, then saved the file that was generated by the tool.

I had to manually copy over the signal configuration reference

This is an issue I've seen, but in the data packs I have downloaded directly from the MCUXpresso SDK generator I haven't seen this structure being used. Parsing these references is be a feature I may add to this script, since following a reference like that is relatively easy to encode.

MIMXRT1060-EVKB.mex.zip

@danieldegrasse danieldegrasse force-pushed the pinctrl-cfg-script branch 3 times, most recently from c3fd3dd to 6a66b36 Compare April 21, 2022 21:00
Add script to parse iMX RT configuration data, including
signal_configuration.xml and MEX files, and output pinctrl SOC level
DTSI files as well as pinctrl groups

Signed-off-by: Daniel DeGrasse <[email protected]>
… parts

Add wrapper script around rt_cfg_utils.py that is able to generate
pinctrl soc DTSI files for all packages defined within a processor

Signed-off-by: Daniel DeGrasse <[email protected]>
Add wrapper script capable of generating pinctrl groups for iMX RT
parts from MEX files, that uses the rt_cfg_utils library

Signed-off-by: Daniel DeGrasse <[email protected]>
add script to generate gpio pinmux settings

Signed-off-by: Daniel DeGrasse <[email protected]>
RT11xx series signal configuration lacks daisy register settings. Add
script to identify these issues and fix them

Signed-off-by: Daniel DeGrasse <[email protected]>
@danieldegrasse
Copy link
Contributor Author

danieldegrasse commented May 2, 2022

@NickolasLapp I've updated this script to use the v11 configuration files from MCUXpresso config tools. Could you verify that the script still works for you?

@dleach02 dleach02 merged commit 897d784 into zephyrproject-rtos:master May 3, 2022
@dleach02 dleach02 deleted the pinctrl-cfg-script branch May 3, 2022 18:37
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

Successfully merging this pull request may close these issues.

4 participants