Issue with S32K146 MCU - FATFS Library and LPSPI Communication Conflict

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Issue with S32K146 MCU - FATFS Library and LPSPI Communication Conflict

167 次查看
KKB
Contributor I

Hello NXP Community,

I am currently working on a project involving the S32K146 MCU and facing a critical issue with SPI communication.

Issue Description:

When I integrate the FATFS library for SD card operations with LPSPI communication, the MCU fails to read the MCU registers correctly. Here's a detailed breakdown of the problem:

  1. SD Card Module: When using only the SD card module with the FATFS library, everything works as expected, and the MCU can read and write to the SD card without issues.
  2. Full BMS Code: The problem arises when I integrate the SD card module with the rest of my BMS code. In this scenario, the MCU fails to read the registers correctly.

Debugging Steps Taken:

  • Verified that the SD card module works fine in isolation.
  • Checked the SPI communication lines for potential conflicts or noise.
  • Ensured that the SPI configurations do not overlap or conflict with other peripherals.
  • Analyzed the code to identify any potential issues with interrupt handling or priority settings.

Additional Information:

  • Microcontroller: NXP S32K146
  • Libraries Used: FATFS library for SD card operations, NXP SDK for S32K146
  • Communication Protocols: LPSPI for SPI communication
  • Symptoms: Failure to read MCU registers when both SD card and other SPI communications are active. No issues when SD card module is used alone.

Request for Assistance:

I would greatly appreciate any insights or suggestions to resolve this issue. Specifically, I am looking for advice on:

  • Potential conflicts between FATFS and LPSPI communication.
  • Best practices for integrating multiple SPI devices with the S32K146 MCU.
  • Any known issues or recommended configurations to avoid register read failures in such scenarios.

Thank you in advance for your support!

Best regards,

Koushik

0 项奖励
2 回复数

106 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @KKB 
this is an application issue, we can provide only very limited support here.
Generally: I would try to avoid sharing of resources on S32K1 devices because there's nothing like semaphores. For example, do not use the same LPSPI instance directly if it is used also by some other stack or task. Also make sure that no re-entrance is happening. This may be an issue if the same resources are used in interrupt handlers.
Regards,
Lukas

0 项奖励

93 次查看
KKB
Contributor I

There is no same LPSPI Instances are used, The problem I am facing is that MCU is trying to access the undefined memory location (0xDEADBEEE). Any help regarding this problem is much appreciated. 

 

Regards,

KoushikWhatsApp Image 2024-06-25 at 16.09.27 (1).jpegWhatsApp Image 2024-06-25 at 16.09.27.jpeg

标记 (1)
0 项奖励