Where to start STM32H7 support

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

Moderators: RoccoMarco, barthess

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Tue Apr 12, 2022 1:43 pm

Hi,

I did and it is not functional in 21.11.1, in trunk there is a working FatFS demo for the STM32H735-Discovery, it will be back-ported to 21.11.2 (next release).

Giovanni

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby fvantienen » Wed Apr 13, 2022 10:20 am

I tried to test it but there is still a problem in the sdc_detect_bus_clk as mentioned before. If I directly return and fix it to 25MHz there is no problem, but somehow it fails to detect the clock correctly. Im running an STM32H743xI. I'm waiting for an sdcard extension to come in to be able to probe it with the logic analyser, but if you already have some idea's of what could be wrong with the sdc_lld_read_special that would be appreciated.

Next to that in sdc_lld_write_aligned there is still a resp initialized which should be sdcp->resp.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Fri Apr 15, 2022 8:12 am

Hi,

I fixed the buffer, about the high speed, apparently it is correctly detected on my STM32H735-Discovery, see the "RT-VFS-FATFS" demo in trunk. Could it be a problem local to your configuration or another brand of SD card? I am testing with a 32GB Kingston card.

Giovanni

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby fvantienen » Wed Apr 20, 2022 2:07 pm

I now analysed the problem, but it seems to work until a certain extend. The problem is actually in the 50MHz mode, so when we don't force it to 25MHz it is switching to 50MHz which causes some problems. Not sure why there are problems in 50MHz mode, as my file writer actually hangs because it can't write fast enough. While in 25MHz there is no problem.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Wed Apr 20, 2022 2:34 pm

Hi,

Is the clock the expected one? it could be out of spec, check you clock settings.

Giovanni

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby fvantienen » Wed Apr 20, 2022 2:50 pm

Yes I get an 50MHz clock, though my logic analyser currently only has 100MSPS so have to take a better look at the scope. But it seems ok.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Wed Apr 20, 2022 3:03 pm

Hi,

Could it be a wiring/electrical problem? how is the SD connector attached?

Giovanni

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby fvantienen » Wed Apr 20, 2022 4:29 pm

It is connected directly on the PCB so it seems unlikely. But will have a similar board with F7 soon so I can test that as well.

Code: Select all

bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk,
                           const uint8_t *buf, uint32_t blocks) {

  osalDbgCheck(blocks < 0x1000000 / MMCSD_BLOCK_SIZE);

  sdcp->sdmmc->DTIMER = STM32_SDC_SDMMC_WRITE_TIMEOUT;

  /* Checks for errors and waits for the card to be ready for writing.*/
  if (_sdc_wait_for_transfer_state(sdcp))
    return HAL_FAILED;

  /* Setting up data transfer.*/
  sdcp->sdmmc->ICR   = SDMMC_ICR_ALL_FLAGS;
  sdcp->sdmmc->MASK  = SDMMC_MASK_DCRCFAILIE |
                       SDMMC_MASK_DTIMEOUTIE |
                       SDMMC_MASK_TXUNDERRIE |
                       SDMMC_MASK_DATAENDIE;
  sdcp->sdmmc->DLEN  = blocks * MMCSD_BLOCK_SIZE;

  /* Transfer modes.*/
  sdcp->sdmmc->DCTRL = SDMMC_DCTRL_DBLOCKSIZE_3 |
                       SDMMC_DCTRL_DBLOCKSIZE_0;

  /* Prepares IDMA.*/
  sdcp->sdmmc->IDMABASE0 = (uint32_t)buf;
  sdcp->sdmmc->IDMACTRL  = SDMMC_IDMA_IDMAEN;

  if (sdc_lld_prepare_write(sdcp, startblk, blocks, sdcp->resp) == true)
    goto error;

  if (sdc_lld_wait_transaction_end(sdcp, blocks, sdcp->resp) == true)
    goto error;

  return HAL_SUCCESS;

error:
  sdc_lld_error_cleanup(sdcp, blocks, sdcp->resp);
  return HAL_FAILED;
}


What I don't get with the code above is how the transaction is started between sdc_lld_prepare_write and sdc_lld_wait_transaction_end?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Where to start STM32H7 support

Postby Giovanni » Wed Apr 20, 2022 5:36 pm

Hi,

The sdc_lld_prepare_write() starts the transactions, sdc_lld_wait_transaction_end() waits for its completion.

Giovanni

fvantienen
Posts: 20
Joined: Thu Nov 08, 2018 11:56 am
Has thanked: 1 time
Been thanked: 2 times

Re: Where to start STM32H7 support

Postby fvantienen » Thu Apr 21, 2022 9:44 am

Thanks I looked a bit more in the manuals from STM32 ad now understand it a bit better. I also found there were some errata's for the STM32H7 SDMMC, but I couldn't figure out if this was causing my problems. https://www.st.com/resource/en/errata_s ... ronics.pdf


Return to “STM32 Support”

Who is online

Users browsing this forum: Bing [Bot] and 16 guests