2018-02-18 03:43 AM
hello
can anybody help me about these code
/////////////////////////////////////////////////////////////////////////////////////////////
/* Enable SPI in Master Mode, CPOL=0, CPHA=0. */
/* Clock speed = fPCLK1 / 256 = 280 kHz at 72 MHz PCLK1 clk. */ SPIx->CR1 = 0x037C; SPIx->CR2 = 0x0000;/////////////////////////////////////////////////////////////////////////////////////////
this is my code below
* SPI configuration */
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_Init(EVAL_SPIx, &SPI_InitStructure);are they equal?if it not equal can tell me what should i change?
2018-02-18 06:09 AM
Presuming an STM32F030 part, not looking to dig through the Reference Manual to confirm bit settings.
Would suggest you do printf('%08X %08X\n', SPIx->CR1, SPIx->CR2); type confirmation