Skip to main content
antonius
Associate III
May 8, 2019
Question

SIM900 question ?

  • May 8, 2019
  • 1 reply
  • 523 views

Dear Members,

I want to test my SIM900 module,

Do I need something more from this code ?

printf("TEST SIM900\r\n");
		//usart_pstr("AT\r\n");
 target =0; //UART1 selected
	printf("AT/r");
 
			HAL_UART_Receive(&huart1, (uint8_t *)&RxModem, 8,100);
			
			
	 HAL_UART_Transmit(&huart3,(uint8_t *)&RxModem, 8,100);

    This topic has been closed for replies.

    1 reply

    antonius
    antoniusAuthor
    Associate III
    May 8, 2019

    correct me ?

    void usart_transmit( char data )
     
    {
    	HAL_UART_Transmit(&huart1, (uint8_t *)&data, 1,100);
    }
     
     
     
    void usart_pstr(char *s) {
    //void usart_pstr(BYTE *s) {
    	// loop through entire string
     
    	while (*s) {
    		usart_transmit(*s);
    		s++;
    	}
    }
     
     
    void test_modem (void)
    { 
    	uint8_t sim900line_buffer[128];
    	char rx_data[5];
    	int x;
    	printf("TEST SIM900\r\n");
    	usart_pstr("ATI\r");
     //target =0; //UART1 selected
    	//printf("AT/r");
     
    			HAL_UART_Receive(&huart1, (uint8_t *)&RxModem, 18,100);
    			//memcpy((void *)sim900line_buffer, RxModem, 10); 
    			
    	 HAL_UART_Transmit(&huart3,(uint8_t *)&RxModem, 18,100);
    			target = 1;
    	 printf("\r\nFinished receiving from SIM900 \r\n");
    				HAL_Delay(3000);