STMicroelectronics / x-cube-iota1

The X-CUBE-IOTA1 is an expansion software package for STM32Cube. The software runs on the STM32 and includes the middleware for enabling the IOTA Distributed Ledger Technology.
https://www.st.com/en/embedded-software/x-cube-iota1.html
Other
16 stars 4 forks source link

IOTA L2Sec stream fails due to STSAFE setup error #4

Closed SedCore closed 6 months ago

SedCore commented 7 months ago

Hello,

I'm trying to run the X-CUBE-IOTA1 v3.0 on the B-U585I-IOT02A board, but after following the tutorial in UM2606 I get the following error when trying to send L2Sec Stream:

image

What can be the reason of the pairing_stsafe result failing, please?

Thanks.

alby0x0c commented 7 months ago

Hi!

I think the causes of the problem could be multiple.

First of all, did you already initialized the STSAFE with other example/packages? If yes, which keys did you use? Just looking at the output you show in the previous post, I think the issue could be simply related to multiple initializations of STSAFE. Pairing (AFAIK) should be done only once in the lifetime of the STSAFE device (see here: https://community.st.com/t5/stm32-mcus-other-solutions/satsafe-a110-fails-pairing/td-p/117411) Indeed, I see successful operations on the STSAFE NVM.

I would suggest you to comment the call to stsafe_pairing() into stsafe_l2sec_init() (which is located in the file: x-cube-iota1/Projects/B-U585I-IOT02A/Applications/IOTA-Client/NetXDuo/App/STSAFE/stsafe.c)

Kind Regards, a.

SedCore commented 7 months ago

I'm using a board that I got from someone, I don't know if he already initialized the STSAFE with other example/packages and if yes, which keys did he use.

Commenting the call to stsafe_pairing() into stsafe_l2sec_init() yields the following error:

image

BenBaratte commented 6 months ago

Hi !

As discussed in the community topic here the issue is link to the new B-U585-IOT2A power management for the STSAFE-A.

Actually, the power pin PF11 is active low therefore, in the x-cube-iota1/Projects/B-U585I-IOT02A/Applications/IOTA-Client/NetXDuo/App/STSAFE/stsafea_service_interface.c in the HW_IO_Init, you have this line which set the PF11 to 1 :

HAL_GPIO_WritePin(STSAFEA_VREG_GPIO_PORT, STSAFEA_VREG_PIN, GPIO_PIN_SET);

Therefore, this disabled the STSAFE-A.

if you replace the line by HAL_GPIO_WritePin(STSAFEA_VREG_GPIO_PORT, STSAFEA_VREG_PIN, GPIO_PIN_RESET);

This is unlocking the STSAFE-A feature.

Best Regards,

Benjamin