cancel
Showing results for 
Search instead for 
Did you mean: 

Good morning all, I have a board to test with n.4 L9026 in daisy chain, driven with a microcontroller STM32G0V1ET. Unfortunately there are no examples on ST website and I am not able to switch on outputs. Any idea?

ECast.12
Associate II

 // Init L9026

 // 00 CHIP_ID, default

 // 01 CFG0, output high side

 // W=1,ADD=1,DATA=00111111,P=0,FR=0

 HAL_Delay(2);

 // Set CS lo on L9026 

GPIOD->ODR&=(~0x02);   // PD1 = 0

 data16=0b1000010011111100;

 SPI_Out_Buffer[0]=SPI_Out_Buffer[2]=SPI_Out_Buffer[4]=SPI_Out_Buffer[6]=(uint8_t) ((data16&0xFF00)>>8);   // Hi bytes

 SPI_Out_Buffer[1]=SPI_Out_Buffer[3]=SPI_Out_Buffer[5]=SPI_Out_Buffer[7]=(uint8_t) (data16&0x00FF);;      // Lo bytes

 HAL_SPI_TransmitReceive(&hspi1,SPI_Out_Buffer,SPI_In_Buffer,8,1000);

 HAL_Delay(2);

 // Set CS hi on L9026

 GPIOD->ODR|=0x02;      // PD1 = 1

...

// Try to activate output

      HAL_Delay(2);

       // 06 PWMSPI, *** OUTPUT STATUS ***

      // W=1,ADD=6,DATA=01010101,P=0,FR=0

       GPIOD->ODR&=(~0x02);   // PD1 = 0

      data16=0b1001101010101000;

      data16=0b1010000000000000;

      SPI_Out_Buffer[0]=SPI_Out_Buffer[2]=SPI_Out_Buffer[4]=SPI_Out_Buffer[6]=(uint8_t) ((data16&0xFF00)>>8);   // Hi bytes

      SPI_Out_Buffer[1]=SPI_Out_Buffer[3]=SPI_Out_Buffer[5]=SPI_Out_Buffer[7]=(uint8_t) (data16&0x00FF);;      // Lo bytes

      GPIOD->ODR&=(~0x02);   // PD1 = 0

      HAL_SPI_TransmitReceive(&hspi1,SPI_Out_Buffer,SPI_In_Buffer,8,1000);

      HAL_Delay(2);

      GPIOD->ODR|=0x02;      // PD1 = 1

0693W00000QKjV8QAL.jpg 

1 REPLY 1
ECast.12
Associate II

Sorry, there was an error due to copy/paste, line "data16=0b1010000000000000;" now removed.

Now outputs are active, even if only SOURCE1 (SOURCE0-SOURCE7). I am investigating...