cancel
Showing results for 
Search instead for 
Did you mean: 

Switching between SPI mode 0 and 1?

monomonster
Associate II
Posted on July 03, 2015 at 12:48

I have a number of devices connected, some sample the data on the rising clock edge, others on the falling edge. Inside the handler structure I want to alternate between these two operation modes.

A method that works is calling the following before each transmit:

hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
HAL_SPI_Init(&hspi3);
or
hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;
HAL_SPI_Init(&hspi3);

This works, but its ugly. Any ''neater'' ideas? Thanks!
0 REPLIES 0