2022-07-08 12:44 AM
// 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
2022-07-08 01:52 AM
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...