yefj
Advanced Member level 5
Hello, I have situation with my EFM32LG where i need to define a manualy operating chipselect select .
I tried to implement it by making GPIO port to act as manual CS,
CS gpio goes low. then i send the data ,then gpio cs goes high.
i tried to implement the idia in the code bellow.
Is the methodology correct?
Thank.
I tried to implement it by making GPIO port to act as manual CS,
CS gpio goes low. then i send the data ,then gpio cs goes high.
i tried to implement the idia in the code bellow.
Is the methodology correct?
Thank.
Code:
SPIDRV_HandleData_t handleData;
SPIDRV_Handle_t handle = &handleData;
SPIDRV_Init_t initData = SPIDRV_MASTER_USART0;
initData.csControl=spidrvCsControlApplication; //manual CS
initData.bitOrder=1; //MSB first send bit order
initData.port->ROUTE &= ~((1 << 8)|(1 << 9)|(1 << 10));
SPIDRV_Init(handle, &initData);
GPIO_PinOutClear(LED_PORT_A,2); //chip select low starts transmition
SPIDRV_MTransmitB(handle, B31_B24, 8);
SPIDRV_MTransmitB(handle, B23_B16, 8);
SPIDRV_MTransmitB(handle, B15_B8, 8);
SPIDRV_MTransmitB(handle, B7_B0, 8);
GPIO_PinOutSet(LED_PORT_A,2); // chip select high,end transmition