Skip to main content
Associate II
June 16, 2023
Solved

Nucleo-U575 & SIM7600G

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

This topic has been closed for replies.
T.DieBest answer
Associate II
June 21, 2023

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

2 replies

Mike_ST
ST Technical Moderator
June 16, 2023

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.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
T.DieAuthorBest answer
Associate II
June 21, 2023

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