2024-11-06 03:12 AM
Good morning,
I'm new to using the STM32. I have a Nucleo H755ZI-Q development kit.
I need to write a command to SPI port type 0xfcd8000 or 0xfcb85b0 or 0x12000000. The max frame can be 32 bits.
On the oscilloscope, I do have an SPI frame, but I always have an additional 0 bit at the end.
I need to keep the value on the falling edge of the clock.
When I write 0xfcd8000 (1111 1100 1101 1000 0000 0000 0000) , the SPI port writes 0x1F9B 0000 (0001 1111 1001 1011 0000 0000 0000 0000).
It took me a while to configure it and I probably made a mistake. Could someone check my settings?
Thank you in advance for your help.
void SEND_COMMAND(uint32_t DATA)
{
/*SPI_DATA_SEND[0] = (DATA >> 24) & 0xFF;
SPI_DATA_SEND[1] = (DATA >> 16) & 0xFF;
SPI_DATA_SEND[2] = (DATA >> 8) & 0xFF;
SPI_DATA_SEND[3] = DATA & 0xFF;*/
WAIT_BUSY();
HAL_GPIO_WritePin(GPIOB, CS1_AD5522_Pin, GPIO_PIN_RESET);
/*HAL_SPI_Transmit(&hspi1, SPI_DATA_SEND, 4, 1000);*/
HAL_SPI_Transmit(&hspi1, (uint8_t*)&DATA, 1, 1000);
HAL_GPIO_WritePin(GPIOB, CS1_AD5522_Pin, GPIO_PIN_SET);
}
SEND_COMMAND(0xfcbb8e4);
2024-11-06 03:20 AM
Check the CPOL and CPHA settings required by your slave circuit and set them accordingly in SPI config.