Skip to main content
antonius
Associate III
July 4, 2019
Question

19200 and 115200 ?

  • July 4, 2019
  • 4 replies
  • 1184 views

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

This topic has been closed for replies.

4 replies

antonius
antoniusAuthor
Associate III
July 4, 2019

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============
 
 

antonius
antoniusAuthor
Associate III
July 4, 2019

I transmit these variables :

  uint8_t aTxBuffer[] ="ATI\r";

      uint8_t aTxBuffer2[] = "AT\r";

Tesla DeLorean
Guru
July 4, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
antonius
antoniusAuthor
Associate III
July 4, 2019

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 ?

Tesla DeLorean
Guru
July 4, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
antonius
antoniusAuthor
Associate III
July 4, 2019

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
antoniusAuthor
Associate III
July 5, 2019
 uint8_t aTxBuffer[] ="ATI\0\r";
		uint8_t aTxBuffer2[] = "AT\0\r";

??