Skip to main content
Laurence Blaxter
Associate II
October 17, 2017
Question

STM32F042 SPI DMA problems

  • October 17, 2017
  • 0 replies
  • 426 views
Posted on October 17, 2017 at 15:08

Hi, I'm trying to read data from mems sensor with an stm32f042 using spi, but unfortunately the spi does not seem to be working. I've used CubeMX to configure the project. The LSM6DSL_Config() function is the first time the spi is used, and it hangs at line 82.

I haven’t added any extra setup code - just using the CubeMX code, am I missing something for configuring the spi?

the spi1 structure looks like this following the hang:

(gdb) p hspi1

 

$3 = {Instance = 0x40013000, Init = {Mode = 260, Direction = 0,

 

    DataSize = 1792, CLKPolarity = 2, CLKPhase = 1, NSS = 512,

 

    BaudRatePrescaler = 16, FirstBit = 0, TIMode = 0, CRCCalculation = 0,

 

    CRCPolynomial = 7, CRCLength = 1, NSSPMode = 0},

 

  pTxBuffPtr = 0x8006368 <LSM6DSL_Config_One> '\r\003', TxXferSize = 2,

 

  TxXferCount = 2, pRxBuffPtr = 0x0, RxXferSize = 0, RxXferCount = 0,

 

  CRCSize = 0, RxISR = 0x0, TxISR = 0x0, hdmatx = 0x200005c8 <hdma_spi1_tx>,

 

  hdmarx = 0x20000584 <hdma_spi1_rx>, Lock = HAL_UNLOCKED,

 

  State = HAL_SPI_STATE_BUSY_TX, ErrorCode = 0}

 

    This topic has been closed for replies.