Reputation: 11
To connect the LoRa module to the stm32 to make wireless transmission and reception I'm trying to send and receive data using the e22-900t22s module, but I'm sending and receiving packets after checking that it's sent and received by hercules, but it's not receiving
receive
transmissionMode();
while (1)
{
HAL_UART_Receive(&huart1, (uint8_t *)rx_buffer, strlen(rx_buffer), HAL_MAX_DELAY);
// 필요에 따라 데이터 전송 주기 조정
HAL_Delay(1000); // 1초 간격으로 송신 (필요 시 조정 가능)
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_8);
}
static void transmissionMode(void)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);
strcpy(mod, "00");
}
transmit
uint8_t msgto5[33] = {
0x00, 0x04, 0x02,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10
};
transmissionMode();
while (1)
{
E22_send(msgto5, sizeof(msgto5));
HAL_Delay(10000);
}
static void transmissionMode(void)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);
strcpy(mod, "00");
}
void E22_send(uint8_t* message, int length)
{
Status = HAL_UART_Transmit(&huart1, message, length, HAL_MAX_DELAY);
if(Status == HAL_OK)
{
memset(tx_buffer, 0, sizeof(tx_buffer));
memcpy(tx_buffer, message, length);
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_8);
}
}
For transmission test, it was simple as above, but I haven't heard anything in the receiverWhy is that?
Upvotes: 0
Views: 23