Page 1 of 1

STM32F746 QSPI

Posted: Fri Oct 20, 2017 10:12 am
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

Re: STM32F746 QSPI

Posted: Sat Oct 21, 2017 5:02 pm
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

Re: STM32F746 QSPI

Posted: Thu Nov 23, 2017 3:09 pm
by elagil
I now just used the "QSPISend" function instead of "QSPICommand" and had no issues. It is working fine!