Example code of TREK1000 (writetospi) is not working

Hi everyone,

I am trying to implement writtospi and readfromspi functions. Readfromspi works well, I can read the deviceID.

But when I try to write, it does not work. I have stm32 micro controller. I used the same code which is written on TREK100 application.
WritetoSpi looks like this;
int writetospi(uint16_t headerLength,
const uint8_t *headerBuffer,
uint32_t bodyLength,
const uint8_t *bodyBuffer)
{
while (HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);

HAL_GPIO_WritePin(DW_NSS_GPIO_Port, DW_NSS_Pin, GPIO_PIN_RESET); 

HAL_SPI_Transmit(&hspi1, (uint8_t *)&headerBuffer[0], headerLength, 10);	
HAL_SPI_Transmit(&hspi1, (uint8_t *)&bodyBuffer[0], bodyLength, 10);	

HAL_GPIO_WritePin(DW_NSS_GPIO_Port, DW_NSS_Pin, GPIO_PIN_SET); 

return 0;

} // end writetospi()

Does anyone have idea what can be reason, that it is not working? I tried to write a data and read it like on the application note APS022.
Thank you.
Best regards