Become a leader in the IoT community!
New DevHeads get a 320-point leaderboard boost when joining the DevHeads IoT Integration Community. In addition to learning and advising, active community leaders are rewarded with community recognition and free tech stuff. Start your Legendary Collaboration now!
Hi @enthernetcode
modify your SPI_PeripheralControl function to use a read-modify-write operation:
“`c
void SPI_PeripheralControl(SPI_RegDef_t *pSPIX, uint8_t EnOrDi)
{
uint16_t temp = pSPIX->CR1;
if(EnOrDi == ENABLE)
{
temp |= (1 << SPI_CR1_SPE); } else { temp &= ~(1 << SPI_CR1_SPE); } pSPIX->CR1 = temp;
}
“`
This approach preserves other bits in the CR1 register while modifying only the SPE bit.
Thanks @wafa_ath currently trying it out, would appreciate it more if u can send the python version of your code, Thanks for the help 🙌
CONTRIBUTE TO THIS THREAD