STM32H743 FMC driver porting from F4/F7

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
dynfer
Posts: 14
Joined: Sun Aug 25, 2024 6:11 pm
Has thanked: 2 times
Been thanked: 5 times

STM32H743 FMC driver porting from F4/F7

Post by dynfer »

Hello,

I've got an problem while using the FMC driver (especially SDRAM). I've attempted to port the driver from ChibiOS-Contrib from F7 to H7. Everything seems to work however I've got a problem that no matter at all i'm not getting a clock output on the FMC_SDCLK pin with AF12 (STM32H743iit6 PG8 in my case). Also I've noticed the FMC_SDSR status bit is completely missing from the H7 and I'm trying to figure a way out without it on the H7.
dynfer
Posts: 14
Joined: Sun Aug 25, 2024 6:11 pm
Has thanked: 2 times
Been thanked: 5 times

Re: STM32H743 FMC driver porting from F4/F7

Post by dynfer »

Managed to fix the clock. Seems the FMC is working correctly all registers written correctly. However when trying to write data to the SDRAM im hardfaulting with an imprecise hardfault. Ive double checked all clock settings and the sdram initialization and everything seems to be correct.
The sdram is connected to Bank1 and mapped to 0xC0000000 in my linker script. Any tips how to troubleshoot this?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32H743 FMC driver porting from F4/F7

Post by Giovanni »

Hi,

I have never tried to write a driver for FMC so cannot help much, you best option is to look at ST initialization code for your driver and check all steps required.

Giovanni
dynfer
Posts: 14
Joined: Sun Aug 25, 2024 6:11 pm
Has thanked: 2 times
Been thanked: 5 times

Re: STM32H743 FMC driver porting from F4/F7

Post by dynfer »

Problem solved.
The ChibiOS-Contrib driver was missing a bit in the BTCR[0] register that enables the FMC.
Line in question FMC_Bank1_R->BTCR[0] |= FMC_BCR1_FMCEN;

Code: Select all

void sdram_lld_start(SDRAMDriver *sdramp, const SDRAMConfig *cfgp)
{
  sdramp->sdram->SDCR1 = cfgp->sdcr;
  sdramp->sdram->SDTR1 = cfgp->sdtr;
  sdramp->sdram->SDCR2 = cfgp->sdcr;
  sdramp->sdram->SDTR2 = cfgp->sdtr;

  FMC_Bank1_R->BTCR[0] |= FMC_BCR1_FMCEN;

  sdram_lld_init_sequence(cfgp);
}



Besides that the driver required minimal adaption for H7 like missing defines for the H7.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32H743 FMC driver porting from F4/F7

Post by Giovanni »

Hi,

If you want to update a community-contributed driver you can go ask in the ChibiOS discord server, there is a dedicated channel there, or make a pull request on the github project.

Giovanni
Post Reply