cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-U575 & SIM7600G

T.Die
Associate

Dear,

Started with the FreeRTOS example I am trying to communicate over uart with a sim7600G. I have setup my usart2. I am able to send data but the returned value contains only the data sended and no response from the sim7600G. 

I have tried with an external serial converter and with the same ports I can read the sim7600G.
For example when I send "AT\n" to the sim7600G with the serial conveter I get "AT\n\nOK\n"

When I send "AT\n" with the nucleo-U575 board I only get "AT\n". What can be wrong in my setup? 

This is my code that I use:

 

for(;;){
		HAL_UART_Receive_IT(&huart2, ReceiveITStr, sizeof(ReceiveITStr));
		HAL_UART_Transmit(&huart2, "AT\n", sizeof("AT\n"), 10);
		osDelay(1000);
		printf("thread ln300: %s\n\n", ReceiveITStr);
		osDelay(30000);
	}

 

Kind regards

1 ACCEPTED SOLUTION

Accepted Solutions

Hello, 

Thank you for your feebdack. 

When I placed the sizeof in a printf it showed "25". So I would think this works correctly. 

printf("connection thread ln300: sizeOf:%i sizeOf:%i receivestr:%s\n", sizeof(ReceiveITStr), sizeof("AT\n"), ReceiveITStr);

After doing some more tests I figured it out. My problem was that I used "\n" and that I needed to use "\r" at the end of the command. I think the "\r" gets added by default by the external converter board. 

Kind regards

View solution in original post

2 REPLIES 2
Mike_ST
ST Employee

Hello,

Maybe

sizeof(ReceiveITStr)

returns 4 as it is a pointer. So that may explain why you're getting only 4 bytes...

Try with a value of 7 as you're expecting 7 bytes.

Hello, 

Thank you for your feebdack. 

When I placed the sizeof in a printf it showed "25". So I would think this works correctly. 

printf("connection thread ln300: sizeOf:%i sizeOf:%i receivestr:%s\n", sizeof(ReceiveITStr), sizeof("AT\n"), ReceiveITStr);

After doing some more tests I figured it out. My problem was that I used "\n" and that I needed to use "\r" at the end of the command. I think the "\r" gets added by default by the external converter board. 

Kind regards