STM32F746 QSPI

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

Moderator: RoccoMarco

Post Reply
elagil
Posts: 94
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 8 times
Been thanked: 7 times

STM32F746 QSPI

Post by elagil »

Hello!

I am using the latest ChibiOS 17.6.2 and I have problems getting QSPI to work.

I enabled the QSPI subsystem.

Here are the settings of mcuconf.h.

Code: Select all

/*
 * QSPI driver system settings.
 */
#define STM32_QSPI_USE_QUADSPI1             TRUE
#define STM32_USE_STM32_D1_WORKAROUND       FALSE
#define STM32_QSPI_QUADSPI1_PRESCALER_VALUE 8
#define STM32_QSPI_QUADSPI1_DMA_STREAM      STM32_DMA_STREAM_ID(2, 7)
#define STM32_QSPI_DMA_ERROR_HOOK(qspip)    osalSysHalt("DMA failure")



The board.c/h files should be correct. I used all the alternate function settings from the reference manual for the four data pins, clock and chip select.

Then, I try to send something, just a command for testing:

Code: Select all

// The QSPI configuration
static const QSPIConfig QSPI_cfg = {
  NULL,
  QUADSPI_DCR_FSIZE_2,
};

// The QSPI command
  qspi_command_t com;
  /**
   * Address on single data line
   */
  com.cfg = QUADSPI_CCR_ADMODE_0;
  com.addr = 0xFF;
  com.alt = 0;

    /* Bus acquisition and SPI reprogramming.*/
    qspiAcquireBus(&QSPID1);
    qspiStart(&QSPID1, &QSPI_cfg);

    qspiCommand(&QSPID1, &com);

    /* Releasing the bus.*/
    qspiReleaseBus(&QSPID1);


The problem is, when calling qspiCommand(), this call inside it breaks it:

Code: Select all

(void) osalThreadSuspendS(&qspip->thread);


meaning that the thread is suspended forever. I had the same problem when I had errors in my board configuration for simple SPI but I cannot find any errors in my board files this time. Also, nothing happens at the QSPI pins, checking with a scope.

Code: Select all

osalSysUnlock();


within qspiCommand() is never reached.

Do you have some suggestions?

Best regards,
Adrian
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F746 QSPI

Post by Giovanni »

Hi,

it appears that the thread is never resumed by a QSPI interrupt so it stays suspended.

It could be an IRQ problem but you get no data at all so it looks like that the operation is not started at all. It could be a DMA setup problem, the transfer is done using DMA.

Which platform are you using? the only QSPI demo is for the STM32L4xx and is under /testex/STM32/STM32L4xx/QSPI-N25Q128

Please make sure to have assertions, checks and state checker enabled in chconf.h, those can detect most problems.

Giovanni
elagil
Posts: 94
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 8 times
Been thanked: 7 times

Re: STM32F746 QSPI

Post by elagil »

I now just used the "QSPISend" function instead of "QSPICommand" and had no issues. It is working fine!
Post Reply