Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

manual chip select for SPI handle

Status
Not open for further replies.

yefj

Advanced Member level 4
Joined
Sep 12, 2019
Messages
1,126
Helped
1
Reputation
2
Reaction score
3
Trophy points
38
Activity points
6,744
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.



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
 

Hi,

Looks good.

If you did the correct port setup and all functions are blocking.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top