1

I'm trying to get answer on AT commands from SIM800L module. I'm using STM32F446RE. I send proper command through USART1, but i don't get any response from module. I've tried different baud rates, but it still doesn't work (SIM800L has auto baut rate detection). I used the same configuration on HC-05 module, and i get response. I observe sent and received(which i don't get) messages through logic analyzer, but it still doesn't work. Module is properly powered, it blinks once in 3 seconds which means its connected to the network. I was trying to find answer for a big amount of time, but i didn't find any. Lower i put some code showing my configurations and screenshots of logic analyzer message and hardware connections. It would be great to get some advices from you to solve this problem.

   void HAL_UART_MspInit(UART_HandleTypeDef* huart){

  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(huart->Instance==USART1)
  {
  /* USER CODE BEGIN USART1_MspInit 0 */

  /* USER CODE END USART1_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_USART1_CLK_ENABLE();

    __HAL_RCC_GPIOA_CLK_ENABLE();
    /**USART1 GPIO Configuration
    PA9     ------> USART1_TX
    PA10     ------> USART1_RX
    */
    GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    /* USART1 interrupt Init */
    HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(USART1_IRQn);
  /* USER CODE BEGIN USART1_MspInit 1 */

  /* USER CODE END USART1_MspInit 1 */
  }
}
static void MX_USART1_UART_Init(void){

  /* USER CODE BEGIN USART1_Init 0 */

  /* USER CODE END USART1_Init 0 */

  /* USER CODE BEGIN USART1_Init 1 */

  /* USER CODE END USART1_Init 1 */
  huart1.Instance = USART1;
  huart1.Init.BaudRate = 9600;
  huart1.Init.WordLength = UART_WORDLENGTH_8B;
  huart1.Init.StopBits = UART_STOPBITS_1;
  huart1.Init.Parity = UART_PARITY_NONE;
  huart1.Init.Mode = UART_MODE_TX_RX;
  huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart1.Init.OverSampling = UART_OVERSAMPLING_16;
  if (HAL_UART_Init(&huart1) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN USART1_Init 2 */

  /* USER CODE END USART1_Init 2 */

}

Logic analyzer time trace Hardware connections

Alrbr
  • 11
  • 1
  • 1
  • Is the SIM800L's DTR pin (pin 11) pulled low to wake up the module? From: https://lastminuteengineers.com/sim800l-gsm-module-arduino-tutorial/ And/or is DTR connected to some pin that you can assert HI/LO? And, what about the other pins (e.g. `RST`)? – Craig Estey Aug 16 '21 at 19:46
  • From _your_ wiring diagram, `DTR` isn't connected to anything. You should note that the `HC-05` doesn't have a `DTR` pin, so that may be the issue. – Craig Estey Aug 16 '21 at 19:52
  • Thank you for the link. I tried to connect DTR pin to the ground, but it still doesn't work. Rest of pins are not connected. I also tried to use serial monitor to send the same command, still no answer from module. – Alrbr Aug 16 '21 at 20:07
  • 1
    Another difference from your wiring: _We cannot directly connect Rx pin on module to Arduino’s digital pin as Arduino Uno uses 5V GPIO whereas the SIM800L module uses 3.3V level logic and is NOT 5V tolerant. This means the Tx signal coming from the Arduino Uno must be stepped down to 3.3V so as not to **damage** the SIM800L module. There are several ways to do this but the easiest way is to use a simple resistor divider. A 10K resistor between SIM800L Rx and Arduino D2, and 20K between SIM800L Rx and GND would work fine._ – Craig Estey Aug 16 '21 at 20:17
  • You may need the resistors mentioned. And, possibly, a new SIM800L module if the comment about "damage" is [really] true. – Craig Estey Aug 16 '21 at 20:20
  • It's all true in Arduino case, but I'm using STM32F446RE and it pins uses 3,3 level logic, so i don't think i destroyed module. – Alrbr Aug 16 '21 at 20:41
  • What about the _"invert tx and rx"_ traditional attempt? – Roberto Caboni Aug 16 '21 at 20:48
  • @RobertoCaboni You may be on to something. From the link in my comment, it seems that its wiring swaps Tx/Rx from OP's wiring. That is, the _labeling_ of the SIM800L TXD pin is reversed from normal/standard. Paraphrasing, it should be: `TXD -- connect host's Tx pin here` – Craig Estey Aug 16 '21 at 21:01
  • @CraigEstey it is actually a common mistake, due to the fact that when a device acts as a modem its pins are named in modem notation. This leads to a counter-intuitive way of naming the pins with an inverted direction: TX is an input because it is a tx pin from host's perspective, CTS is an output for the same reason. Counter-intuitive and difficult to remember: that's why sometimes its easier to swap pins instead of trying to guess what is the notation used in the documentation. – Roberto Caboni Aug 17 '21 at 05:41

0 Answers0