mbed-ce / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
37 stars 12 forks source link

Adding NUCLEO-U545RE-Q and NUCLEO-U5A5ZJ-Q support, with some changes to stm_dma_utils #273

Closed wdx04 closed 2 months ago

wdx04 commented 2 months ago

Summary of changes

Updated STM32U5 firmware package to the latest version (Making it possible to support STM32U5G9 boards).

Added NUCLEO-U545RE-Q and NUCLEO-U5A5ZJ-Q targets (USB is not supported yet).

Added a macro in ST QSPI driver to allow using the high IO port of an OSPI peripheral in QUAD IO mode. (Because I have a custom STM32U575RI board that connects the high IO port (IO4~7) to a W25Q128JV flash).

Added some API functions in stm_dma_utils. mainly to deal with the DMA handle matrix, for working with external DMA code (SDIO, UART, etc). (stm_dma_utils.c defined all the default DMA handlers, conflicting with external DMA code unless NVIC_SetVector is used).

Documentation

To use the high IO ports of an OSPI peripheral in QUAD IO mode, add the "QSPI_OSPIM_IOPORT_HIGH=1" macro in the target definition:

    "STM32U575RI": {
        "inherits": [
            "MCU_STM32U575xI"
        ],
        "public": true,
        "device_name": "STM32U575RITx",
        "mbed_rom_start": "0x08000000",
        "mbed_rom_size": "0x200000",
        "mbed_ram_start": "0x20000000",
        "mbed_ram_size": "0xc0000",
        "device_has_add": [
            "QSPI",
            "OSPI"
        ],
        "components_add": [
            "QSPIF"
        ],
        "macros_add": [
            "QSPI_OSPIM_IOPORT_HIGH=1"
        ],
        "config": {
            "hse_value": {
                "value": "12000000",
                "macro_name": "HSE_VALUE"
            }
        },
        "overrides": {
            "clock_source": "USE_PLL_HSE_XTAL"
        }
    }

Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

I need help with running Greentea tests. For now, I just compiled and run simple blinky apps on all of NUCLEO-U545RE-Q, NUCLEO-U5A5ZJ-Q, NUCLEO-U575ZI-Q, B-U585I-IOT02A targets. I also run an app using SPI, OSPI, UART, I2C and RTC on a custom STM32U575RI board without a problem. It's unlikely to break existing STM32U5 applications.


JohnK1987 commented 2 months ago

Hello and thanks for the PR, running GreenTea is easy - https://github.com/mbed-ce/mbed-os/wiki/Running-the-Mbed-Greentea-Tests-Locally I also did a fast note in the past - https://github.com/mbed-ce/mbed-os/discussions/116#discussioncomment-4488470

Don't hesitate to ask, I believe we can do it together.

BR, Jan

wdx04 commented 2 months ago

Hello and thanks for the PR, running GreenTea is easy - https://github.com/mbed-ce/mbed-os/wiki/Running-the-Mbed-Greentea-Tests-Locally I also did a fast note in the past - #116 (reply in thread)

Don't hesitate to ask, I believe we can do it together.

BR, Jan

Hi, Jan,

Thank you for your help, I have managed to run GreenTea on my NUCLEO-U545RE-Q and NUCLEO-U5A5ZJ-Q boards, unfortunately, both targets failed the same tests:

The following tests FAILED:
          9 - test-mbed-drivers-lp-timeout (Failed)
         42 - test-mbed-hal-sleep-manager (Failed)
         88 - test-mbed-rtos-systimer (Failed)
Errors while running CTest

Error information on NUCLEO-U545RE-Q:

9  >>> Running case #1: 'Callback called once'...
   <greentea test suite>:68::FAIL: Expected TRUE Was FALSE
42 <greentea test suite>:228::FAIL: Values Not Within Delta 196 Expected 1638 Was 1840. lp ticker sleep time incorrect
88 <greentea test suite>:345::FAIL: Values Not Within Delta 5000 Expected 42000 Was 48126

Error information on NUCLEO-U5A5ZJ-Q:

9  >>> Running case #1: 'Callback called once'...
   <greentea test suite>:68::FAIL: Expected TRUE Was FALSE
42 <greentea test suite>:228::FAIL: Values Not Within Delta 196 Expected 1638 Was 1847. lp ticker sleep time incorrect
88 <greentea test suite>:345::FAIL: Values Not Within Delta 5000 Expected 42000 Was 48279

I will look into the errors later. Thanks.

multiplemonomials commented 2 months ago

Ah I should mention, the Mbed greentea tests don't actually all pass right now, especially for targets where changes have been made after the end of official Mbed development. We don't have the infrastructure yet to run them, but I am working on it.

multiplemonomials commented 2 months ago

Thank you so much for your contribution! Responded with a couple things to look into in the code

wdx04 commented 2 months ago

Ah I should mention, the Mbed greentea tests don't actually all pass right now, especially for targets where changes have been made after the end of official Mbed development. We don't have the infrastructure yet to run them, but I am working on it.

All failed tests are related to deep sleep mode. I tried to run the failed tests as stand-alone apps. When compiled in Develop mode, they seem to be passable. For example, in the test-mbed-hal-sleep-manager test, I got a deep sleep time of 1751 ticks (53.4ms) on NUCLEO-U545RE-Q instead of 1840 ticks as shown in the Greentea output.