Other Parts Discussed in Thread: CC1101
Hi;
I do not want to send the lenght of my buffer. I just want to send exactly my buffer but on my code if ı do not send a size of my buffer first and even if I change the inside of my buffer, it continues to send old data. Even PKTCTRL0 (Packet automation control) is "0x05",it is meaning Infinite packet length mode. So ı do not need to send a size of buffer. But my problem is lets say ı am sending a fener[26] buffer and ı delete the send a size of buffer on cc1101_send_packet function and change the sending data lets say ı made packet[26] and reload program again but it still send old(fener[26]) data. but when ı open the sending size function in cc1101_send_packet function
My codes;
void SpiCWriteBurstReg(uint8_t Addr,uint8_t *Buffer,uint8_t Count)
{
uint8_t i=0;
uint8_t temptxburst[Count+2];
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET);
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
// temptxburst[0] = SPI_ReadWrite(Addr|WRITE_BURST); // adreside yanlislikla yazdirdigim yer.
temptxburst[0] = Addr|WRITE_BURST;
HAL_SPI_Transmit(&hspi1,&temptxburst[0],1,10);
HAL_SPI_Transmit(&hspi1,Buffer,Count,10); // DATA TOPLU GONDERIM
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET);
}
void SPiCWriteReg(uint8_t Addr,uint8_t Value)
{
// SPiCPowerUpReset();
Power_up_reset();
uint8_t Data_Write[2];
Data_Write[0]=Addr;
Data_Write[1]=Value;
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET);
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1,Data_Write,2,10);
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET);
}
void SpiCStrobe(uint8_t Strobe)
{
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_RESET); //CS enable
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_6) != GPIO_PIN_RESET);
SPI_ReadWrite(Strobe);
HAL_GPIO_WritePin(SPI1_CSn_GPIO_Port, SPI1_CSn_Pin, GPIO_PIN_SET); //CS disable
}
void cc1101_send_packet(uint8_t* txBuffer, uint8_t size)
{
SpiCStrobe(CCxxx0_SIDLE);
SPiCWriteReg(CCxxx0_TXFIFO, size); //I DO NOT WANT TO SEND SIZE . when i close this program is not working correctly.
SpiCWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size);
SpiCStrobe(CCxxx0_STX);
}
uint8_t DataBufferX1[26]= {0x19, 0x44, 0x55, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x65, 0x20, 0x54, 0x75, 0x72, 0x61, 0x6E, 0x20, 0x20, 0x43, 0x43, 0x31, 0x31, 0x30, 0x31, 0x20};
uint8_t fener[26] = {0x66, 0x65, 0x6e, 0x65, 0x72, 0x62, 0x61, 0x68, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x6b, 0x20, 0x79, 0x61, 0x73, 0x61, 0x20, 0x6f, 0x6f, 0x6f, 0x6c, 0x65, 0x79};
uint8_t packet[26] = {0x43, 0x43, 0x31, 0x31, 0x30, 0x31, 0x20, 0x74, 0x61, 0x6d, 0x61, 0x6d, 0x6c, 0x61, 0x6e, 0x64, 0x69, 0x20, 0x59, 0x45, 0x53, 0x53, 0x53, 0x21, 0x21, 0x21};
while (1)
{
HAL_Delay(500);
SpiCStrobe(CCxxx0_SFTX);
cc1101_send_packet(fener,26 );
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_2) == GPIO_PIN_SET);// while(HAL_GPIO_ReadPin(GDO0_GPIO_Port, GDO0_Pin));
while(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_2) != GPIO_PIN_SET);// while(!HAL_GPIO_ReadPin(GDO0_GPIO_Port, GDO0_Pin));
}