Handshake failed external memory FreeRTOS heap

Hello everyone,

I am encountering a challenging issue with mbedTLS during SSL handshake processes in my project. I hope to gain some insights or solutions from the community’s vast experience.

Project Setup:

  • RTOS: FreeRTOS
  • TLS Library: mbedTLS
  • Hardware: Embedded platform with both internal memory and external HyperRAM.

Problem Description: In my setup, everything functions correctly when the FreeRTOS heap is allocated in the internal memory. Specifically, the mbedTLS library successfully completes the SSL handshake without any issues. However, when I transition the FreeRTOS heap to be hosted in the external HyperRAM, I start experiencing failures during the SSL handshake.

Technical Details:

  • The exact error I encounter when the heap is in HyperRAM is MBEDTLS_ERR_SSL_INTERNAL_ERROR with an error code of -0x6C00.
  • This problem manifests during the mbedtls_ssl_setup, which is responsible for setting up the SSL context based on my configurations.

Steps Taken:

  • I have confirmed that the HyperRAM is stable and functional as other components like ethernet_data operate correctly when hosted on it.
  • My mbedtls_config.h and memory management routines are standard, and the system operates as expected with internal memory.

Request for Assistance: I am looking for insights into what might be causing this issue when switching the heap to HyperRAM. Could this be related to memory alignment, access speed, or perhaps specific configurations within mbedTLS that are sensitive to where the heap is located?

Additional Considerations:

  • Any tips on adjusting mbedTLS settings or FreeRTOS configurations that might cater to external memory usage would be greatly appreciated.
  • If anyone has faced similar challenges or has debugging suggestions that could help isolate this issue, your input would be invaluable.

Thank you for taking the time to read this post. I am looking forward to your suggestions and any assistance you can provide to help resolve this peculiar issue.

Best regards, Emo