cancel
Showing results for 
Search instead for 
Did you mean: 

Problem interfacing gsm module with stm32h747 disco board

KiruV
Associate II

We're working a camera based person fall detection device with STM32H747 and B-CAMS-OMV camera module, we want to interface GSM module with it to make alert calls in case of fall being detected but we're facing issues with the same.

 

We're not able to interface the GSM module properly with the board,

the GSM module is being powered up and getting connected to cellular network but it's not responding to commands from the board. 

 

We're trying to set up USART communication between the board and the GSM module but the GSM module is not responding to the commands.

 

Kindly help us with the same.

 

10 REPLIES 10
Pavel A.
Evangelist III

Try this simple loopback program to test communication between STM32 and the GSM.

It uses two STM32 UARTs, one to the PC (maybe via debugger VCP) another to the GSM.

Assume the UARTs are already set up.

On the PC type commands in some terminal app like teraterm, observe output.

 

 

#include <stm32f7xx_ll_usart.h>

extern UART_HandleTypeDef huart5; // Modem
extern UART_HandleTypeDef huart2; // Terminal

void t_modem_loop()
{
  USART_TypeDef *UW = huart5.Instance;
  USART_TypeDef *UT = huart2.Instance;
  for(;;)
  {
     if (LL_USART_IsActiveFlag_RXNE(UW)) {
	 if (LL_USART_IsActiveFlag_TXE(UT)) {
	     LL_USART_TransmitData8(UT, LL_USART_ReceiveData8(UW));
	 }
     }

     if (LL_USART_IsActiveFlag_RXNE(UT)) {
	 if (LL_USART_IsActiveFlag_TXE(UW)) {
	     // Stop on ^C
	     uint8_t ch = LL_USART_ReceiveData8(UT);
	     if (ch == 3) {
		 break;
	     }
	     if (ch == '\n') {
		 ch = '\r';
	     }
	     while (!LL_USART_IsActiveFlag_TXE(UT)) {}
	     LL_USART_TransmitData8(UT, ch); // echo
	     LL_USART_TransmitData8(UW, ch);
	 }
     }
  }
}