Skip to main content
PJose.4
Senior
June 13, 2024
Question

TFM SPI issue in custom board with STM32u585aii6q

  • June 13, 2024
  • 3 replies
  • 2905 views

Hi @Jocelyn RICARD 
Greetings

we are trying to run TFM example (with secure and non secure project) taken from GPIO_Toggle_TZEN Example and adding SPI communication in the non secure project on our custom board mounted with STM32U585aii6q controller SPI is getting stuck at timeout error(in the transmit function/receive function. Init function is working fine).

we tried the same on B-U585-IOT2A controller and the communication is working perfectly. 

to verify our hardware we tried the SPI communication on the same board without TFM and its working perfectly.

we wanted to know if there is any other additional dependency while using TFM to add peripherals like SPI. with TFM configuration GPIO is working fine without any issues.

Awaiting your valuable suggestions so that we can understand and resolve the issue.
Thanks and Regards
Philip 

3 replies

Jocelyn RICARD
ST Employee
June 13, 2024

Hello @PJose.4 ,

form your description I understand that:

SPI is working on both boards without TFM

SPI is working on B-U585-IOT2A with TFM

SPI is not working on your board with exact same chip as B-U585-IOT2A with same TFM

What differences in the configurations between the 2 boards?

Do you have different clocking, different power ?

Can you see any signal on MOSI when launching transmit ?

Best regards

Jocelyn

PJose.4
PJose.4Author
Senior
June 19, 2024

Hi @Jocelyn RICARD 

Sorry for the late reply

the understanding is correct

the code wise everthing is same except for the pin numbers used in spi1 for the custom board.

EVM board using PE13, PE14, PE15 for SPI and SPI CS PE12

Custom Board Using PI1, PI2, PI3 and PI12 as SPI CS(changed pin out was updated in the code accordingly.)

Our query is : is there any special configuration with respect to GTZC or clock or any other with respect to TFM peripheral initialization and configuration(specially in the TFM Application from ST official Package)

to initialise any peripheral like SPI, I2C, in the TFM_Appli_NonSecure Code,  do we have to make any configuration in the TFM_Appli_Secure or TFM_SBSFU_Boot.

 

Thanks for your continued support

Regards

Philip

Jocelyn RICARD
ST Employee
June 19, 2024

Hello @PJose.4 ,

The TFM porting source code is available, there is no hidden configuration :)

Regarding your issue, it looks like it is related to GPIO configuration.

After reset GPIO are all secure. In TFM code, you can find function pinmux_init_cfg() that sets all GPIO accessible to non secure ... except GPIOI

I guess this is because the porting was originally made on STM32L5 that does not have this GPIO port.

So to fix your issue, you just need to add the initialization of GPIOI in this pinmux_init_cfg() function.

Best regards

Jocelyn

 

PJose.4
PJose.4Author
Senior
June 20, 2024

Hi @Jocelyn RICARD 

Thanks for your support
the SPI issue in port I got solved. Thanks again

but couple of queries here
1, we are facing issues when configuring adc to read a pin value (PC0 - TFM Non Secure Application + Eval Board) - its getting HAL_TIMEOUT error. the pinmux function as you mentioned in the above post has included port c. is there any configuration required to do in GTZC or other areas.

2. We also want to write some data into the SRAM2(available portion) and backupram from the TFM Appli Non Secure.could you please suggest the method to do(apart from the test shown in app_rot.c) example can i connect to the app_rot partition and use the TFM_APP_ROT_IOCTL_SIGNAL to write and read data from the SRAM2 and backupRAM?

Thanks for your continued support
Regards
Philip

Jocelyn RICARD
ST Employee
June 20, 2024

Hello @PJose.4 ,

 

1, we are facing issues when configuring adc to read a pin value (PC0 - TFM Non Secure Application + Eval Board) - its getting HAL_TIMEOUT error. the pinmux function as you mentioned in the above post has included port c. is there any configuration required to do in GTZC or other areas.

Nothing should be needed here. You may first check your implementation in a non secure environment to validate the behaviour.

 

2. We also want to write some data into the SRAM2(available portion) and backupram from the TFM Appli Non Secure.could you please suggest the method to do(apart from the test shown in app_rot.c) example can i connect to the app_rot partition and use the TFM_APP_ROT_IOCTL_SIGNAL to write and read data from the SRAM2 and backupRAM?

SRAM2 is fully allocated to TFM.  Backup SRAM should be accessible to non secure (to be checked).

To access secure part you must create a service in TFM. You have TFM documentation for that.

Best regards

Jocelyn

Jocelyn RICARD
ST Employee
July 23, 2024

Hello @PJose.4 ,

ticket was routed to my colleagues of Apec region. I'm located in EMEA. I will try to get it.

Best regards

Jocelyn

PJose.4
PJose.4Author
Senior
July 23, 2024

Hi @Jocelyn RICARD 

Thanks again
Regards
Philip