2025-12-02 2:11 AM
Hi!
I am trying a very simple test to receive the correct boot-up sequence which should be 0x55 0xAA and I am using this code:
void ST67W_test(void)
{
printf("\r\n*** Bare-metal ST67W SPI Test ***\r\n");
// 1. Turn module ON
HAL_GPIO_WritePin(CHIP_EN_GPIO_Port, CHIP_EN_Pin, GPIO_PIN_SET);
// 2. Wait for RDY = HIGH (boot event present)
while (HAL_GPIO_ReadPin(SPI_RDY_GPIO_Port, SPI_RDY_Pin) == GPIO_PIN_RESET) {;}
// 3. Assert CS = HIGH (begin frame)
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
// 4. Perform SPI transfer
uint8_t tx[8] = {0};
uint8_t rx[8] = {0};
if (HAL_SPI_TransmitReceive(&NCP_SPI_HANDLE, tx, rx, 8, 100) != HAL_OK)
{
printf("\r\nSPI transfer failed!\r\n");
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
return;
}
printf("\r\nRX: %02X %02X %02X %02X %02X %02X %02X %02X\r\n",
rx[0], rx[1], rx[2], rx[3], rx[4], rx[5], rx[6], rx[7]);
// 5. CS = LOW -> end of frame
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
// 6. Done, turn off module
HAL_GPIO_WritePin(CHIP_EN_GPIO_Port, CHIP_EN_Pin, GPIO_PIN_RESET);
}
I have tried three different boards with the NUCLEO-67W61M1 but with the same faulty result:
*** Bare-metal ST67W SPI Test ***
Waiting for SPI_RDY...
RDY boot detected.
RX: 01 55 00 00 00 00 01 00
Feels like some timing issue, but I am using the same SPI settings as in CubeMX examples:
Many thanks in advance for any hints