Problem with SPI transmission on G071
Hi,
I am having problems sending a part of an array with SPI. It is no problem to send 4 Bytes from the beginning of the array, but if I want to send 4 Bytes from another starting position (for example: start from tmp[1]) it does not work. In this case I can see on the oscilloscope that the command and the address are transmitted and after that comes nothing.
Any ideas??
uint8_t tmp[6] = {6,1,6,1,5,5};
uint8_t *ptr = &tmp[0];
uint8_t *ptr2;
uint8_t command = 0, len=4, address = 0x07;
ptr2 = &tmp[1];
HAL_GPIO_WritePin(SPISSN_GPIO_Port, SPISSN_Pin, RESET);
// Write & Length
command = 0x80 | (len & 0x7F);
HAL_SPI_Transmit(&hspi2, (uint8_t*)(&command), 1, 100);
//address
HAL_SPI_Transmit(&hspi2, (uint8_t*)(&address), 1, 100);
//send "len" bytes of data
HAL_SPI_Transmit(&hspi2, tmp, len, 100); //ok
HAL_SPI_Transmit(&hspi2, ptr, len, 100); //ok
HAL_SPI_Transmit(&hspi2, ptr2, len, 100); //NOT ok
HAL_GPIO_WritePin(SPISSN_GPIO_Port, SPISSN_Pin, SET);
Kind regards,
Bernd
