2024-10-10 01:44 AM - last edited on 2024-10-10 02:59 AM by SofLit
Hello,
In pair with the LT8722 I use Stm32 Nucleo U5A5ZJQ and TECF1S Peltier device (7v and 1.2A)
Currently as I am trying to communicate with it through the SPI. Just basic status acquisition packet 32bit transmit and 32bit receive. I send 0xF0001491 and there are three cases.
void SPI_Status_Acquisition(uint8_t command, uint8_t register_address)
{
printf(" Status Acquisition Packet \n");
memset(spirx_buffer, 1, sizeof(spirx_buffer));
//Command 8bit -> Address 8bit -> CRC 8bit -> 0xXX ignored 8bit
spitx_buffer[0] = command; // 1 byte for command
spitx_buffer[1] = register_address; // 1 byte for register address
spitx_buffer[2] = 0x00; // 1 byte for CRC
spitx_buffer[3] = 0x91; // 1 byte of padding data
crc = calculate_crc(spitx_buffer, 2);
spitx_buffer[2] = crc;
HAL_Delay(100);
HAL_GPIO_WritePin(TEC_CS_GPIO_Port, TEC_CS_Pin, GPIO_PIN_RESET);
HAL_Delay(100);
HAL_SPI_TransmitReceive(&hspi1, spitx_buffer, spirx_buffer, 4, HAL_MAX_DELAY);
HAL_Delay(100);
HAL_GPIO_WritePin(TEC_CS_GPIO_Port, TEC_CS_Pin, GPIO_PIN_SET);
HAL_Delay(100);
}
Regarding the other SPI packets Data write and Data read, I am lost, because it is 64bit receive and 64bit transmit. How can I send or receive through SPI at once, per one action whole 64 bits? Dividing it into array and sending one-by-one just make it think that every cell is an individual packet.
Thank you.
2024-10-10 02:59 AM - last edited on 2024-10-10 03:10 AM by Andrew Neil
Hello @Metyus ,
Please kindly use </> button to paste your code. See this post for posting tips. I'm editing your post.
Thank you for your understanding.
2024-10-10 03:19 AM - edited 2024-10-10 03:22 AM
So this: https://www.analog.com/en/products/lt8722.html
@Metyus wrote:Just basic status acquisition packet
So this:
@Metyus wrote:there are three cases.
- CS pin cycle (high->low->high->low->high) is done twice...
- CS pin cycle (high->low->high) is done...
- CS pin cycle (high->low->high)...
No, there is only 1 case shown in that diagram:
Have you used an oscilloscope or logic analyser to verify what is actually happening on the wires?
Have you checked out AD's demo software: https://www.analog.com/en/products/lt8722.html#evaluation-kit ?