cancel
Showing results for 
Search instead for 
Did you mean: 

SCK Active during CS High

STayl.3
Associate II

I'm making use of the STM32L433 and using SPI to communicate with a LLCC68 from Semtech.

I've noticed that my SCK is active after my CS goes high.

Is this normal behavior?

Code Snippet for SPI Write:

LLCC68_StatusTypeDef spiWrite(uint8_t* data, uint8_t size)
{
	uint8_t dummy;
	uint16_t SPItmo = 0;
 
	//Radio Busy Check
	while(BUSY_GPIO_Port->IDR & BUSY_Pin) {osDelay(10);}
 
	//NSS LOW
	NSS_GPIO_Port->ODR &= ~(NSS_Pin);
 
	//Write Data to Register(s)
	while(size--)
	{
		SPItmo = 0;
		while(((SPI2->SR & SPI_SR_TXE) == RESET) && (SPItmo < SPITIMEOUT)){SPItmo++;};
		*((__IO uint8_t *) &SPI2->DR) = (*data++); //*(&spiData[i])
 
		//SPItmo = 0;
		//while(((SPI2->SR & SPI_SR_RXNE) == RESET) && (SPItmo < SPITIMEOUT)){SPItmo++;};
 
		dummy = (uint8_t)SPI2->DR;  // dummy read
		//Clear OVR Flag
		dummy = SPI2->SR;
	}
 
	//Wait for last byte to be transferred from Shift Register :: When bit is high, data transfer is in progress
	while((SPI2->SR & SPI_SR_BSY) && (SPItmo++ < SPITIMEOUT));
 
	//NSS High
	NSS_GPIO_Port->ODR |= NSS_Pin;
 
	//Error Checking
	if(SPItmo > SPITIMEOUT)
	{
		return LLCC68_SPIERROR;
	}
	else
	{
		return LLCC68_OK;
	}
}

0693W00000UokhpQAB.jpg

0 REPLIES 0