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

Request STM32H5 support! #810

Closed
hydra opened this issue Mar 18, 2023 · 6 comments · Fixed by #811
Closed

Request STM32H5 support! #810

hydra opened this issue Mar 18, 2023 · 6 comments · Fixed by #811
Labels

Comments

@hydra
Copy link
Contributor

hydra commented Mar 18, 2023

The STM32 H5 is a new CortexM33 MCU from ST Micros. ST released all the datasheets, reference manuals, updated cubemx a few days ago.

https://www.st.com/en/microcontrollers-microprocessors/stm32h5-series.html

https://www.st.com/en/microcontrollers-microprocessors/stm32h562rg.html

We need a PAC for it ASAP please!

I can't find the SVD files on ST's website yet, but using Eclipse CMSIS Packs plugin I was able to find a set of SVD's from Keil. Attached.

Keil-STM32H5-SVD-v1.0.0.zip

@newAM newAM added the stm32h5 label Mar 18, 2023
@David-OConnor
Copy link
Contributor

Initial error from svd2rust:

[ERROR svd2rust] Error parsing SVD XML file

    Caused by:
        0: In device `STM32H562`
        1: In peripheral `ADC1`
        2: In register `ADC_CFGR`
        3: Parsing field `EXTSEL0` at 854:15
        4: `EnumeratedValue error: Value 2 out of range 0..2

Relevant section of SVD:

  <field>
                <name>EXTSEL0</name>
                <description>External trigger selection for regular group
These bits select the external event used to trigger the start of conversion of a regular group:
...
Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).</description>
                <bitOffset>5</bitOffset>
                <bitWidth>1</bitWidth>
                <access>read-write</access>
                <enumeratedValues>
                  <enumeratedValue>
                    <name>B_0x0</name>
                    <description>adc_ext_trg0</description>
                    <value>0x0</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x1</name>
                    <description>adc_ext_trg1</description>
                    <value>0x1</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x2</name>
                    <description>adc_ext_trg2</description>
                    <value>0x2</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x3</name>
                    <description>adc_ext_trg3</description>
                    <value>0x3</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x4</name>
                    <description>adc_ext_trg4</description>
                    <value>0x4</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x5</name>
                    <description>adc_ext_trg5</description>
                    <value>0x5</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x6</name>
                    <description>adc_ext_trg6</description>
                    <value>0x6</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x7</name>
                    <description>adc_ext_trg7</description>
                    <value>0x7</value>
                  </enumeratedValue>
                  <enumeratedValue>
                    <name>B_0x1F</name>
                    <description>adc_ext_trg31</description>
                    <value>0x1F</value>
                  </enumeratedValue>
                </enumeratedValues>
              </field>

@burrbull
Copy link
Collaborator

Initial error from svd2rust:

[ERROR svd2rust] Error parsing SVD XML file

    Caused by:
        0: In device `STM32H562`
        1: In peripheral `ADC1`
        2: In register `ADC_CFGR`
        3: Parsing field `EXTSEL0` at 854:15
        4: `EnumeratedValue error: Value 2 out of range 0..2

Relevant section of SVD:

Just remove all autogenerated enumeratedValues. They are useless anyway:

_clear_fields: ["*"]

@hydra
Copy link
Contributor Author

hydra commented Mar 21, 2023

<bitWidth>1</bitWidth>

The width is wrong here right?

image

image

ST's own documentation is confused too!

My suggestion is to combine the fields into one 5 bit field, called EXTSEL, using the values specified in EXTSEL1 and then delete EXTSEL0, EXTSEL1, etc.

@David-OConnor David-OConnor mentioned this issue Mar 21, 2023
@bors bors bot closed this as completed in 78e5071 Mar 22, 2023
@hydra
Copy link
Contributor Author

hydra commented Mar 22, 2023

Fantastic timely work @David-OConnor and @adamgreig much appreciated, I'm trying the nightlies out now.

https://github.com/stm32-rs/stm32-rs-nightlies/tree/master/stm32h5

🥳

@Dirbaio
Copy link

Dirbaio commented Mar 27, 2023

stm32-metapac v2.0.0 has H5 support.

WIP HAL support is here embassy-rs/embassy#1300

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

Successfully merging a pull request may close this issue.

5 participants