Tool/software:
// The SpiBuffer_Init(); function runs normally on a single CPU. Now, if we add another CPU to 28388 and run the function on CPU2, the system data will be abnormal.
void SpiBuffer_Init(void) {
if (cpu1_to_cpu2_info.mcu_id != SABS_MCU1)
{
// If this is MCU2, we do not initialize the buffer here
// as it is handled by the CPU1 initialization.
return;
}
uint16_t i = 0;
spi_buf.write_pos = 0; // Reset write pointer to start
spi_buf.read_pos = 0; // Reset read pointer to start
spi_buf.valid_len = 0; // Clear valid data length
// Clear buffer contents to avoid residual data
for (i = 0; i < BUFFER_DEPTH; i++)
{
spi_buf.buffer[i] = 0;
}
}