cancel
Showing results for 
Search instead for 
Did you mean: 

How to SWITCH HSI to LSE for STM8L152C6 discovery board?

FCai.1
Associate

When I switch HSI to LSE using IAR, there is always an error that "Failed to get execution status: SWIM error [30004]: Comm timeout"

There is switch function:

void HSI_TO_LSE(void)

{

  

 if(CLK_SCSR!=0x08)    // if LSE is not selected as the system clock source

  CLK_SWCR_SWEN=1;     // Enable clock switch 

  CLK_SWR=0x08;      // Switch HSI to LSE

  while(CLK_SWCR_SWBSY);  // Wait until LSE ready

  CLK_SWCR=0x00;

}

0 REPLIES 0