cancel
Showing results for 
Search instead for 
Did you mean: 

19200 and 115200 ?

antonius
Senior

Dear Members,

I tried to talk with SIM7600 using UART1,

The code was working ok with SIM900,

Now,it's giving me the result but it's not right,

Is it because of baudrate ? it was 19200 for SIM900

and now 115200 for SIM7600

the code :

void test_modem (void)
{  
	char rx_data[5];
	int x;
	
	printf("TEST SIM7600SA-H\r\n");
 
	HAL_UART_Transmit_IT(&huart1,(uint8_t*)&aTxBuffer, sizeof(aTxBuffer));
	    HAL_UART_Receive_IT(&huart1, (uint8_t *)&SIM900.rxBuffer,1);
 
	  
				HAL_Delay(5000);
				 HAL_UART_Transmit_IT(&huart1,(uint8_t*)&aTxBuffer2,sizeof(aTxBuffer2)); 
				 HAL_UART_Receive_IT(&huart1, (uint8_t *)&SIM900.rxBuffer,1);             
				HAL_Delay(5000);
	//scanf(rx_data,"OK \r\n");
  
	
	
}

callback

void	SIM900_CallBack(void)
{
	
	
	SIM900.LastTime=HAL_GetTick();
	if(SIM900.rxIndex < sizeof(SIM900.rxBuffer)-2)
	{
		SIM900.rxBuffer[SIM900.rxIndex] = SIM900.rxTmp;
		SIM900.rxIndex++;
		 memcpy((void *)line_buffer_SIM900, SIM900.rxBuffer, SIM900.rxIndex); 
		  
	    
	}	
	HAL_UART_Receive_IT(&_SIM900_USART,&SIM900.rxTmp,1);
	
	printf("%s",line_buffer_SIM900);
	
}

on main :

void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart)
{   
	if(huart->Instance==USART2)
		{
			.
                       .
		}	
	if(huart->Instance==USART1)
		{ 
			SIM900_CallBack();
			GPS_Flag=0;
			
     
		}
	UartReady = SET;
}

Any clues or pseudo code ? thanks

8 REPLIES 8
antonius
Senior

output from SIM

TEST SIM7600SA-H
                                                              
AT
                                                                            
 RMn GATATP CATATATAT_GATATATATIATAT.ATAT8ATAT7ATAAT
                          
 RMn GATATP CATATATAT_GATATATATIATAT.ATAT8ATAT7ATATAT
                         
 RMn GATATP CATATATAT_GATATATATIATAT.ATAT8ATAT7ATATAAT
                        
 RMn GATATP CATATATAT_GATATATATIATAT.ATAT8ATAT7ATATAT============
   
 

I transmit these variables :

  uint8_t aTxBuffer[] ="ATI\r";

      uint8_t aTxBuffer2[] = "AT\r";

Doing printf of unbound strings in a callback or interrupt is inadvisable, likely taking multiple byte times.​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Thanks for the reply,

then how can I print the received message?

Pseudo code or example ? I have made another process, but it must be called from callback....is it ok ?

Perhaps buffer the messages you want to send, and then dispatch in the foreground while you do the 5 second wait.

Remember also that C strings need to be properly NUL terminated.​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

Remember also that C strings need to be properly NUL terminated.​....

" NUL terminated " ... \0 on my transmitter command ?

so "AT\r\0" ?

antonius
Senior

is it possible there's an issue with voltage level and grounding ?

I used a power from Desktop USB with a different port and from the documentation, it needs 1.83V max...

0690X000009YQdDQAW.jpg

antonius
Senior
                uint8_t aTxBuffer[] ="ATI\0\r";
		uint8_t aTxBuffer2[] = "AT\0\r";

??