2024-03-08 02:05 PM
Hello,
I'm currently sending AT commands to the Grove LoRa E5 module from Seed Studio, when I send commands like "AT," there is no response from the module. I've connected the module to the USART of the STM32L476RG board. If anyone has encountered and resolved a similar issue, i'd greatly appreciate your help.
Best Regards.
2024-03-08 02:23 PM
Debugging doesn't require others to have done it previously.
Diagram exactly how you have it wired.
Common ground, TX-RX crossed over to the L4
Show code / baud rate settings, check baud rate, default assume is 9600 8N1
Check if it is in data mode, try +++ escape sequence
2024-03-08 02:30 PM
I am using the Seed Shield for wiring purposes. I am unsure about the process of sending commands. Do I simply need to initialize the UART with a baud rate of 9600, or is there a specific code that I should implement for this purpose?
2024-03-08 02:57 PM
You have the NUCLEO-L476RG board?
Link to this "Seed Shield" board, and the connectors used/connects to the "Grove LoRa E5"
Is it connecting to a UART or I2C Grove connector? Which UART on the NUCLEO are you using?
Does that conflict with the ST-LINK's UART connectivity? Using the Arduino D0/D1 pins?
You should be able to send "AT\r\n" via a HAL_UART_Transmit() function. Make a wrapper fuction to manage strings. Perhaps have a HAL_UART_ReceiveIT() method set up to catch responses that could be immediate. Perhaps get a scope on the signals so you can confirm things are happening.
2024-03-09 12:25 AM
Yes I am using the NUCLEO-L476RG board, and i am using arduino shield and connect lora with UART not I2C.
I am able to send "AT\r\n" via UART and i can see it in the terminal but when i send AT command via serial i got no response from lora.
When i send a caracter via uart and send it back using HAL_UART_Receive and HAL_UART_Transmit i am able to see it in the serial.
I am using this shield and i am connecting lora with UART to it : https://wiki.seeedstudio.com/Base_Shield_V2/
2024-03-10 10:10 AM
Hi,
This is my code :
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
char command[50] ;
char response[50];
char message1[] = "uart 1 receive\n";
char message2[] = "uart 2 receive\n";
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if(__HAL_UART_GET_FLAG(&huart1, UART_FLAG_RXNE) == SET){
HAL_UART_Transmit(&huart2, (uint8_t*)message1, strlen(message1), HAL_MAX_DELAY);
HAL_UART_Receive(&huart1, (uint8_t*)response, strlen(response), HAL_MAX_DELAY);
HAL_UART_Transmit(&huart2, (uint8_t*)response, strlen(response), HAL_MAX_DELAY);
}
if(__HAL_UART_GET_FLAG(&huart2, UART_FLAG_RXNE) == SET){
HAL_UART_Transmit(&huart2, (uint8_t*)message2, strlen(message2), HAL_MAX_DELAY);
HAL_UART_Receive(&huart2, (uint8_t*)command, strlen(command), HAL_MAX_DELAY);
HAL_UART_Transmit(&huart1, (uint8_t*)command, strlen(command), HAL_MAX_DELAY);
}
}
/* USER CODE END 3 */
}
I am using USART1 for lora and USART2 for Serial.
Best regards,