Skip to main content
Visitor II
September 4, 2024
Question

Problem interfacing gsm module with stm32h747 disco board

  • September 4, 2024
  • 4 replies
  • 2120 views

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.

 

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    September 4, 2024

    Hello,

    Check baurate/parity/stop bit configuration.

    Super User
    September 4, 2024

    @Mike_ST wrote:

    Check whether your module expects "\r\n" or just "\n" at the end of each AT command.


    The AT command terminator should be just CR.

    Super User
    September 4, 2024

    @KiruV wrote:

    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.


    So what testing/investigation/debugging have you done to find what's going on?

    • Is your code actually transmitting anything at all?
    • Is your wiring correct & complete - eg, does the module require just TX/RX, or does it also need other lines?
    • Is your code transmitting at the correct voltage, with correct baud rate, etc?
    • If all the above are correct, is your code actually sending valid commands?
    • Are the commands actually reaching the GSM module? 

    Before getting into embedded code, have you manually tested your interactions with the GSM module using a terminal?

    In the Posting Tips are some hints on debugging serial comms:

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/tac-p/706966/highlight/true#M49

    Try those to see what's actually happening between your STM32 abd the GSM module...

    KiruVAuthor
    Visitor II
    September 6, 2024

    First in order to debug, I tried manually testing USART communication separately:
            * I've separately tried USART communication between PC terminal and STM32 board- it works,
            * Separately tried communication between GSM Module and Arduino-it works.
    The GND of both the STM32 and GSM has been connected commonly.

    the GSM is still not responding to the AT commands, I sent a simple AT command for which the module is supposed to reply with OK but it is not doing so.

     

    Screenshot 2024-09-06 143035.png

     

    Code:

    KiruV_3-1725613531535.png

     

    KiruV_2-1725613477582.png

    Is there anything I could be doing wrong? What can i try to do now

    KiruVAuthor
    Visitor II
    September 6, 2024

    I tried another debugging, I connected PD5(which is the USART2 Tx) to PD6(Rx) directly and tried a loopback test just to see if the channel is working.....it is not, the loopback test itself fails..

    so i think the mistake is in the configuration and initialization itself,
    but I can not tell what is wrong with the configurations, everything seems to be correct.

    KiruV_0-1725645550436.png

    KiruV_1-1725645555745.png

    KiruV_2-1725645593015.png

     

     

     

    Visitor II
    September 4, 2024

    Some GSM modules can echo back sent characters. Try sending simple AT commands like AT\r\n and see if you get an OK response.

    Super User
    September 4, 2024

    @liaifat85 wrote:

     Try sending simple AT commands like AT\r\n .


    The command terminator is just CR:

    AndrewNeil_0-1725463392058.png

    https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=323

    AndrewNeil_1-1725463785397.png

    https://www.itu.int/rec/T-REC-V.250 (supersedes the https://www.itu.int/rec/T-REC-V.25ter referenced in GSM07.07)

     

     

    Super User
    September 7, 2024

    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);
    	 }
     }
     }
    }