In NRF24_Write_8Bit_Register
after i send my command function i need to read SPI1->DR to clear 0x00 value from it. but i didn't. Thats why i had to call read functions twice. This is the proper way to do it:
(NOTE: Thank you hcheung for your help. After reading your comment i got the answer.)
void NRF24_Write_8Bit_Register(uint8_t NRF24_Register, uint8_t NRF24_Register_Bit, uint8_t NRF24_Set_Reset){
uint8_t buffer_write = 0xFF;
uint8_t buffer_read = 0;
NRF24_Read_8Bit_Register(NRF24_Register, &buffer_write);
if(NRF24_Set_Reset == 1){
buffer_write |= NRF24_Register_Bit;
}else{
buffer_write &=~ NRF24_Register_Bit;
}
SysTick_Delay_uS(10);
GPIO_ResetBits(GPIOA,GPIO_Pin_4);
SPI_I2S_SendData(SPI1, (0x20 | NRF24_Register));
buffer_read = SPI_I2S_ReceiveData(SPI1);
while(!(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)));
buffer_read = SPI_I2S_ReceiveData(SPI1);
while(!(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE)));
SPI_I2S_SendData(SPI1, buffer_write);
while(!(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)));
buffer_read = SPI_I2S_ReceiveData(SPI1);
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_BSY));
GPIO_SetBits(GPIOA,GPIO_Pin_4);
SysTick_Delay_uS(20);
}