FAT32 Initialisation issues at low temperatures

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
M5M8S10
Posts: 16
Joined: 21 Nov 2017 10:03
Location: Germany

FAT32 Initialisation issues at low temperatures

#1 Post by M5M8S10 » 18 Jan 2021 16:51

Hello Forum,

my Hardware (Mikromedia HMI-50) has problems initialising the storage device via the FAT32 library at low temperatures. At temperatures near 0°C or slighly below, the MCU gets stuck in the function FAT32_Init(), i.e. the function does not exit. I tested the device in the climatic chamber with serveral SD-Cards. A industrial-grade SD-card from kingston (-40°C to 85°C) provides the best performance so far, but the above described issue still occurs (albeit less frequently). The MCU sometimes just won't get through the initialisation.
I post the code for initialising the external memory, on which the resource file of the HMI is stored. The code is mostly copied from the Hardware Pattern Mikromedia_HMI_5_RTP, which comes with the IDE mikroPascal PRO for FT90x. It is slightly changed in my efforts the resolve this issue.

Here is the code (MikroPascal):

Code: Select all


procedure Init_Ext_Mem();
begin
  rfHandle    := -1;
  rfName      := 'HMI_ZMB_.RES';
  rfStartSect := 0;

  // Init SDHost interface at low speed
  Mmc_Set_Interface(_MMC_INTERFACE_SDHOST);
  SDHost_Init(128, _SDHOST_CFG_4_WIDE_BUS_MODE or _SDHOST_CFG_CLOCK_FALING_EDGE);
  Delay_ms(100);
  // wait additionally for sd card detection:
  // (dynamic waiting routine)
  while (SDHost_CardDetect() <> _SDHOST_STATUS_CARD_INSERTED) do
    nop;

  // initialise storage device and read FAT32 boot sector:
  // (retries every second in case of error)
  GPIO_PIN15_bit := 1;                                                          // debug_led_orange
  while (FAT32_Init() <> 0) do						   // <- THIS LINE
  begin
    GPIO_PIN15_bit := 0;                                                        // debug_led_orange
    Delay_ms(1000);
    GPIO_PIN15_bit := 1;                                                        // debug_led_orange
  end;
  GPIO_PIN15_bit := 0;                                                          // debug_led_orange
  
  //  Reinitialize SDHost at higher speed
  SDHost_Init(16, _SDHOST_CFG_4_WIDE_BUS_MODE or _SDHOST_CFG_CLOCK_FALING_EDGE);

  // Open resource file for read
  rfHandle    := FAT32_Open(@rfName, 0x01);
  rfStartSect := FAT32_ClustToSect(fat32_fdesc[rfHandle]._1stClust);
  
end;

When I look into the .lst file while debugging, the MCU seems to loop this block:

Code: Select all


;__Lib_SDHost.mpas, 1319 ::                 
L__SDHost_SendCMD362:
0x1A28        0x64000013  LDK.L        R0, #19
0x1A2C        0x003430B6  CALL        __Lib_SDHost_SDHost_ReadReg+0
0x1A30        0x44004024  AND.L        R0, R0, #2
0x1A34        0x5DE04002  CMP.L        R0, #0
0x1A38        0x0028068A  JMPC        R30, Z, #1, L__SDHost_SendCMD362


The Product on which I am working on has to work in this range of temperatures. I am thankfull for any help.

Cheers M.

User avatar
filip.grujcic
Posts: 822
Joined: 14 May 2018 08:34

Re: FAT32 Initialisation issues at low temperatures

#2 Post by filip.grujcic » 19 Jan 2021 15:01

Hello,

I believe I answered you on the ticket you've opened.

Regards,
Filip Grujcic

Post Reply

Return to “Libstock Discussion”