how to define SPI handle location manually

Thread Starter

yef smith

Joined Aug 2, 2020
I want define my SPI handle communication to be port E oriented(EFM32LG controller),As seen in the data sheet photo bellow. By looking at this table from the datasheet we see that in order to be PORT E oriented ,we need to choose USART0 LOC0 for my SPI handle.But When i looked at The API from the link bellow and the photo, i saw that by default USART0 uses LOCATION1, So i tried to change this location to loc1.

By looking at Init data from my HANDLE i saw only a variable called PORT which was USART TYPE Threw it i tried to go to the USART ROUTE and manually change to location ZERO, by putting 0 to the 8th 9th places of the register by the register map shown in the end.

Did i defined LOCATION ZERO for USART0 of my handle correcly?
SPIDRV_HandleData_t handleData;
SPIDRV_Handle_t handle = &handleData;
initData.csControl=spidrvCsControlApplication; //manual CS
initData.bitOrder=1; //MSB first send bit order

initData.port->ROUTE &= ~(1 << 8);
initData.port->ROUTE &= ~(1 << 9);
initData.port->ROUTE &= ~(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