This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137: AUTOSAR SPI driver is not working in UserMode

Part Number: TMS570LS3137

Hello everyone,

in my current project we are using a TMS570LS3137 with an SafeOS configured as SC3 (MPU) together with TI MCAL 5.40.00. The whole TI MCAL is integrated as part of a NonTrusted OS-Application (no privilege rights), which means that the TI MCAL will be executed in UserMode.

Unfortunately, this is not working properly. After a first analyis it seems that the SPI driver (and maybe also the other drivers) has only implemented direct register access, instead of using the Os_ReadPeripheral and Os_WritePeripheral APIs.With these APIs the SPI driver would be able to enter privileged write-protected register-bits/fields within UserMode.

I didn't find any information in the available documentation that the MCAL need to be executed with privilege rights (e.g. Supervisor). So, could you please explain how the MCAL shall be used properly in a partitioned ASIL-environment, where other QM BSW modules are directly calling the SPI driver APIs?

OS based (non-) trusted functions seems not to be working due to inconfigurable APIs labels in the remaining QM based BSW standard software modules.

Thanks for your support in advance!

Best regards

Michael

  • Hi Michael,

    The privilege mode is required to initialize the SPI module. Most of the SPI APIs can be used in user mode

  • Hi QJ Wang,

    thanks for your answer!

    You're right that most (or all) SPI APIs can be used in user mode, but then all write protected bits/fields within the SPI controller registers can not be set. 

    In my project we tried exactly the same. MCAL initialization is done before StartOS() in privilege mode. After StartOS() the SPI APIs are used/executed as part of the QM partition in user mode only. But in user mode the SPI is no longer working. Then we granted privilege rights to the QM partition and everything works fine. This is of course not suitable for our SaetyCase, because the QM partition as NonTrusted Os-Application shall not have any privilege rights at all (freedom of interference).

    My assumption is now that the write protected register bits/fields are mandotory for proper SPI functionaltiy (e.g. SPIGCR0, SPIGCR1, SPIFMT, MIBSPIE, SPI Extended Prescale Register 1). Could you please confirm?

    Maybe other MCAL modules are also affected by this restriction?...

    So, again my initial question, do you or anyone else know how the MCAL shall be used in a safe-partitioned AUTOSAR architecture? Or is MCAL version 5.40.00 not meant to be used in such architectures?

    Thanks and best regards

    Michael

  • Hi Michael,

    I forwarded your question to our MCAL expert. He will answer your question soon. Thanks