Using CMSIS
Hi,
I have set up a Nucleo with three EasySpin boards and have two way communications working fine by coding the GPIO pins bit by bit. However, I want to take advantage of the on-chip SPI h/w. Ironically this much harder to set up than coding it all by hand.
SPI_TypeDef
SPI_InitTypeDef SPI_InitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); // release SPI1 from reset state
SPI_Cmd(SPI1, DISABLE); // some configs must be done when disabled.
SPI_InitStruct.SPI_Direction=SPI_Direction_2Lines_FullDuplex ;
SPI_InitStruct.SPI_Mode=SPI_Mode_Master;
SPI_InitStruct.SPI_CPOL=SPI_CPOL_High; // SCK=1 s idle
SPI_InitStruct.SPI_CPHA=1; //SPI_CPHA : 2nd transition is data capture edge.
SPI_InitStruct.SPI_NSS=SPI_NSS_Soft;
SPI_InitStruct.SPI_BaudRatePrescaler=SPI_BaudRatePrescaler_32; // 32,64,128,256
SPI_InitStruct.SPI_FirstBit=SPI_FirstBit_MSB;
SPI_Init(SPI1,&SPI_InitStruct);
SPI_Cmd(SPI1, ENABLE);
When I try to send a byte by writing to the DR and polling TXE it never happens. Where can I find a thorough guide that tells ALL I need to to know configure the device using CMSIS without going to the chip reference manual and programming each register bit by bit ?
Thanks.