SIM900接收缓冲区问题

时间:2018-05-02 21:53:26

标签: c stm32 uart sim900

实际上我正在使用SIM900,接收字符有问题,所以我发送给芯片的每条消息都收不到“OK”。我想发短信或拨打电话 我使用STM32F429 waveshare board及其下面的功能以及我为通信实现的功能:

void SIM900_Init(void)
{
  HAL_UART_Transmit(&huart3, (uint8_t*)aTxBuffer1, sizeof(aTxBuffer1), 1000);
  HAL_Delay(50);
  HAL_UART_Transmit(&huart3, (uint8_t*)aTxBuffer2, sizeof(aTxBuffer2), 1000);
  HAL_Delay(50);
}
void SIM900_SendSMS(void)
{
  HAL_UART_Transmit(&huart3, (uint8_t*)aTxBuffer3, sizeof(aTxBuffer3), 1000);
  HAL_Delay(50);
  HAL_UART_Transmit(&huart3, (uint8_t*)aTxBuffer4, sizeof(aTxBuffer4), 1000);
  HAL_Delay(50);
  HAL_UART_Transmit(&huart3, message, sizeof(message), 1000);
  HAL_Delay(50);
  HAL_UART_Transmit(&huart3, (uint8_t*)CtrlZ, sizeof(CtrlZ), 1000);
  HAL_Delay(50);
}

在主要内容中,我将这两个函数称为:

  uint8_t aRxBuffer[255];
.......
SIM900_USART3_UART_Init();
  SIM900_Init();
  SIM900_SendSMS();


  /* Infinite loop */
  while (1)
  {    
    // Start receiving the data via USART3
    HAL_UART_Receive(&huart3, (uint8_t *)aRxBuffer, 255, 1000);

    .........

0 个答案:

没有答案