Other Parts Discussed in Thread: ADS1298R, ADS1298
Hi TI Support,
I'm trying to interface the ADS1298R ECGFE with STM32 microcontrôleur using SPI peripheral.
Unfortunately, I'm not able to read the device ID after sending 0b0010 0000 0b0000 0000 as command.
I always receive nothing, below is my SPI Configuration:
/* Initialize all configured peripherals */
hSpi->Instance = SPI1;
hSpi->Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4; // To get 20 MHz frequency
hSpi->Init.Direction = SPI_DIRECTION_2LINES;
hSpi->Init.CLKPhase = SPI_PHASE_2EDGE; // CPHA High
hSpi->Init.CLKPolarity = SPI_POLARITY_LOW; // CPOL Low
hSpi->Init.DataSize = SPI_DATASIZE_8BIT;
hSpi->Init.FirstBit = SPI_FIRSTBIT_MSB;
hSpi->Init.TIMode = SPI_TIMODE_DISABLE;
hSpi->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hSpi->Init.CRCPolynomial = 7;
hSpi->Init.CRCLength = SPI_CRC_LENGTH_8BIT;
hSpi->Init.NSS = SPI_NSS_SOFT;
hSpi->Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
hSpi->Init.Mode = SPI_MODE_MASTER;
My GPIOs pins configuration is as following:
/* Enable peripherals and GPIO Clocks */
CONF_SPI1_PIN_MOSI_GPIO_CLK_ENABLE();
CONF_SPI1_PIN_MISO_GPIO_CLK_ENABLE();
CONF_SPI1_PIN_SCK_GPIO_CLK_ENABLE();
CONF_SPI1_PIN_SSn_GPIO_CLK_ENABLE();
/* Configure peripheral GPIO */
/* SPI SCK GPIO pin configuration */
GPIO_InitStruct.Pin = CONF_SPI1_PIN_SCK;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = CONF_SPI1_PIN_SCK_ALTERNATE;
HAL_GPIO_Init(CONF_SPI1_PIN_SCK_GPIO, &GPIO_InitStruct);
/* SPI MISO GPIO pin configuration */
GPIO_InitStruct.Pin = CONF_SPI1_PIN_MISO;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Alternate = CONF_SPI1_PIN_MISO_ALTERNATE;
HAL_GPIO_Init(CONF_SPI1_PIN_MISO_GPIO, &GPIO_InitStruct);
/* SPI MOSI GPIO pin configuration */
GPIO_InitStruct.Pin = CONF_SPI1_PIN_MOSI;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Alternate = CONF_SPI1_PIN_MOSI_ALTERNATE;
HAL_GPIO_Init(CONF_SPI1_PIN_MOSI_GPIO, &GPIO_InitStruct);
GPIO_InitStruct.Pin = CONF_SPI1_PIN_SSn;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
HAL_GPIO_Init(CONF_SPI1_PIN_SSn_GPIO, &GPIO_InitStruct);
HAL_GPIO_WritePin(CONF_SPI1_PIN_SSn_GPIO, CONF_SPI1_PIN_SSn, GPIO_PIN_SET);
I have to mention that I'm wiring only SPI Pins (SCK, NSS, MISO, MOSI) with the J3 Connector. and I have kept the same jumpers position like mentioned on the ADS1298RECG-FE User's Guide.
Is my SPI Configuration correct?
BR.
ghada.