cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP257F-EV1: How to assign SPI3 GPIOB pins to M33? A35 SPI3 disabled but M33 cannot toggle PB1/PB7

Amruta_Dixit
Associate II

Hello ST team,

I am working on STM32MP257F-EV1 with OpenSTLinux. I want to interface an external ADC from the M33 core using SPI3.

Target pins on 40-pin header:

PB1  = SPI3_NSS / manual CS
PB7  = SPI3_SCK
PB8  = SPI3_MOSI
PB10 = SPI3_MISO

I created a custom Linux DTB for M33 SPI usage:

stm32mp257f-ev1-ca35tdcid-ostl-m33spi.dtb

In this DTB, I disabled SPI3 from A35/Linux:

spi@400c0000 {
    compatible = "st,stm32mp25-spi";
    reg = <0x400c0000 0x400>;
    status = "disabled";
};

I also changed /boot/mmc1_extlinux/extlinux.conf default entry to boot with this DTB:

DEFAULT OpenSTLinux-M33SPI

LABEL OpenSTLinux-M33SPI
        KERNEL /Image.gz
        FDT /stm32mp257f-ev1-ca35tdcid-ostl-m33spi.dtb
        INITRD /st-image-resize-initrd
        APPEND root=PARTUUID=491f6117-415d-4f53-88c9-6e0de54deac6 rootwait rw earlycon console=${console},${baudrate}

After reboot, I confirmed A35/Linux SPI3 is disabled:

cat /sys/firmware/devicetree/base/soc@0/bus@42080000/spi@400c0000/status

Output:

disabled

Also Linux is not binding SPI3:

ls -l /sys/bus/platform/drivers/spi_stm32/ | grep 400c0000
ls /sys/bus/spi/devices/
ls /dev/spidev*

No SPI3/spidev is present.

M33 is running:

cat /sys/class/remoteproc/remoteproc0/name
cat /sys/class/remoteproc/remoteproc0/state

Output:

m33
running

I tested the M33 firmware by blinking LED3, and LED3 blinks correctly, so the M33 firmware is running.

However, when I try to toggle PB1 from M33 as a simple GPIO output, there is no waveform on header pin 24. Because SPI3 also uses GPIOB pins PB7/PB8/PB10, SPI3 waveforms also do not appear.

My simple M33 GPIO test:

__HAL_RCC_GPIOB_CLK_ENABLE();

GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

while (1)
{
    HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_1);
    HAL_Delay(500);
}

LED3 still blinks in other test code, but PB1 does not toggle.

I checked OP-TEE patch/source and found that the STM32MP257 pinctrl GPIOB node appears as disabled:

pinctrl: pinctrl@44240000 {
    compatible = "st,stm32mp257-pinctrl";

    gpiob: gpio@44250000 {
        gpio-controller;
        #gpio-cells = <2>;
        interrupt-controller;
        #interrupt-cells = <2>;
        #access-controller-cells = <1>;
        reg = <0x10000 0x400>;
        clocks = <&rcc CK_BUS_GPIOB>;
        st,bank-name = "GPIOB";
        status = "disabled";
    };
};

I also found RIF-related definitions:

STM32MP25_RIFSC_SPI3_ID  = 24
STM32MP25_RIFSC_GPIOB_ID = 161
RCC_RIF_GPIOB            = 91

SPI3 RIF entry in OP-TEE patch appears open/non-secure:

RIFPROT(STM32MP25_RIFSC_SPI3_ID, RIF_UNUSED, RIF_UNLOCK,
        RIF_NSEC, RIF_NPRIV, RIF_UNUSED, RIF_SEM_DIS, RIF_CFDIS)

My question:

For STM32MP257F-EV1, what is the correct way to assign GPIOB and SPI3 to the M33 core?

Specifically:

  1. Is disabling spi@400c0000 in the Linux DTB enough to release SPI3 from A35?

  2. How should GPIOB be enabled/assigned for M33 so that PB1/PB7/PB8/PB10 can be controlled by M33?

  3. Should this be done in OP-TEE RIF device tree, TF-A RIF configuration, or Linux DT?

  4. What exact RIF/GPIO configuration is required for:

    • GPIOB / PB1 / PB7 / PB8 / PB10

    • SPI3 peripheral

  5. Is status = "disabled" for gpiob: gpio@44250000 expected in OP-TEE source, or should it be changed to "okay" for M33 GPIO usage?

I previously tried modifying TF-A/OP-TEE/RIF files, but the board stopped booting, so I want to know the correct safe method before changing boot-critical files again.

Current confirmed status:

A35/Linux SPI3 disabled: yes
M33 remoteproc running: yes
M33 LED blink works: yes
M33 PB1 GPIO toggle: not working
M33 SPI3 SCK/MOSI waveform: not working

Please suggest the correct device tree / RIF / OP-TEE configuration flow to give SPI3 and GPIOB access to M33 on STM32MP257F-EV1.

0 REPLIES 0