- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
Following my previous experience with an Optiga Trust X Evaluation Kit, I started working with an Optiga Trust Mv3.
I am using a ARM Sitara Cortex-A8 AM3352 in bare metal as a host processor in my circuit. I cloned the repository available here to start working with the Trust M: https://github.com/Infineon/optiga-trust-m I saw that there wasn't any Platform Abstraction Layer already available for my processor, so I followed the steps of this guide (https://github.com/Infineon/optiga-trust-m/tree/develop/pal/NEW_PAL_TEMPLATE) to understand what I had to implement in my PAL. After finishing it, I wanted to test it on Infineon's examples, available in the repo at optiga-trust-m/examples/optiga/.
My first experience was to try the example_optiga_init_deinit.c program, to see if I was able to start communications with the Trust M correctly. I changed that code a little bit to adapt it to my needs: I am using the I2C in polling mode for the Cortex-A8, so the WAIT_AND_CHECK_STATUS macro loops on timers to check if their deadline was reached or not, instead of waiting for interrupts. The two main functions called for the initialization of communications between the two processors are optiga_util_create and optiga_util_open_application. I don't have any issue executing these functions, everything seems to perform as expected.
What I understood is that the optiga_util_create function creates an event, later triggered as a callback by a timer reaching its deadline. This mecanism is used 4 times after executing the optiga_util_create function: first callback is optiga_cmd_queue_scheduler, which then calls back optiga_cmd_event_trigger_execute, which then calls back ifx_i2c_init 2 times. I followed every step of that execution, and everything seems fine to me. The i2c bus is initialized and is ready to receive some traffic. I have an oscilloscope and a UART session to debug in case it's needed.
When creating an instance of optiga_util_t with optiga_util_create, a callback function is associated, to give upper layers the state of execution in Infineon's layers. In the example_optiga_init_deinit.c file, that callback changes the state of a variable which is used as a condition in the WAIT_AND_CHECK_STATUS loop.
I noticed that I was never exiting that loop, even though all the previous function executions seemed to be fine.
After a bit of investigation, I understood that I was never leaving that loop because the variable was never changed, meaning that the callback function associated to my instance of optiga_util_t was never called.
My question is the following: When and where is that optiga_util_t associated callback supposed to be triggered ? Is there documentation somewhere detailing all the steps in the init of communications with the Trust M ?
I can't figure out a way of getting out of that loop. It seems to me that the initialization is complete and that's it's just a callback issue, but I might be wrong and there might be a deeper issue that I didn't notice.
Thank you for you answer !
Solved! Go to Solution.
- Labels:
-
OPTIGA™ Trust M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Karishma_S,
After a little bit more investigation, I saw that I didn't have any callback after reading or writing in my pal_i2c, which is my fault. I forgot to complete that part of the pal because I didn't read the comments well enough.
After completing it and changing my timer system to the single hardware timer with a flag only, I seem to have a working solution. I'll create another thread if I have issues, but I think I am now on the right track. You can close this thread for now.
Sorry for such a stupid mistake !
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @MaxMartin,
The reason why it hangs is mostly the incorrect implementation of pal_os_event, the callback mechanism has to be precise. Can you please check the implementation of pal_os_event?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Karishma_S,
Thank you for you answer. As a first draft, I am using a hardware timer available on my Cortex-A8, ticking every 1 milliseconds. In that hardware timer interrupt, I just increase the number of milliseconds since startup by 1, and that's all.
In order to manage several timers for callbacks, I created a list of 8 software timers, which are configured as such :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Karishma_S,
After a little bit more investigation, I saw that I didn't have any callback after reading or writing in my pal_i2c, which is my fault. I forgot to complete that part of the pal because I didn't read the comments well enough.
After completing it and changing my timer system to the single hardware timer with a flag only, I seem to have a working solution. I'll create another thread if I have issues, but I think I am now on the right track. You can close this thread for now.
Sorry for such a stupid mistake !
Regards