cancel
Showing results for 
Search instead for 
Did you mean: 

using the UART on Semtech SX1272MB2DAS Lora shield plugged onto the SMT32L475 Discovery kit IoT

DNeet.1
Associate II

I'm using the Semtech SX1272MB2DAS Lora shield on the SMT32L475 Discovery kit IoT node.

ON the Lora shield there is a UART plug which takes a Grove cable. I connected that to a legacy PCB which I managed to operate using an Arduino. It's just a simple serial connection, where commands are transmitted and received via Tx/Rx.

I have an oscilloscope attached to the Tx/Rx pins, and with the Arduino I would see the voltage oscillations as I send data, indicateing that it is working.

When I use the following code, nothing happens:

MX_USART2_UART_Init();
HAL_UART_Transmit(&huart2, msg, sizeof(msg), 1000);  

msg contains a particular byte sequence which the sensor expects. How can I address the Grove UART on the Lora schield. According to the specs, the UART has been pinned through to the STM32L475 MCU so it should be adressable.

Failing that, how can I communicate with this device using UART from the STM32 Discovery kit IoT Node?

5 REPLIES 5

"nothing happens"

Check the clocks are enabled for the UART and associated pins.

Check you're using the right pins, surely D0/D1 are PA0/PA1 using UART4

Check the UART registers are readable in the debugger.

Check the definition of msg

Try

while(1) HAL_UART_Transmit(&huart2, "U", 1, 1000);

Make sure the RX/TX sense is correct and not switched around.

Review the schematics in the User Manual for the Disco IoT board

https://www.st.com/resource/en/user_manual/dm00347848-discovery-kit-for-iot-node-multichannel-communication-with-stm32l4-stmicroelectronics.pdf

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

Thx for the pointers. I'm struggling a bit, and would appreciate help.

When I added

SystemClock_Config();

to the code in MBed Studio, the program froze.

So I reverted back to ST32CubeIDE.

When I try to run a simple program on the board from ST32CubeIDE, I get the following error:

Error in initializing ST-LINK device.

Reason: ST-LINK firmware upgrade required. Please upgrade the ST-LINK firmware using the upgrade tool.

However I ran the ST-LinkUpgrade.exe tool several times, and can connect to the board easily using STM32 ST-LINK Utility.exe

I have no idea what this means

And you updated it to what firmware version? V2J36 is perhaps the most current

What version of STM32CubeIDE, and OpenOCD, etc?

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

ST-LINK: V2.J34.M25

STM32CubeIDE: Version: 1.3.1

I'm using GDB-Server. Wherre can I find the Version No.?

0693W000001rF2HQAU.png

DNeet.1
Associate II

Thx for the advice. I updated to V2J36 and this is working now.

I removed the Lora SX1272MB2DAS shield, and pinned straight into the Discovery IoT Board.

In the code I am also starting the Clock (I think so, SystemClock_Config()) and UART4 (pins PA0 and PA1 -> TX/D1 and RX/D0 resp.) :

  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_USART1_UART_Init();
  MX_USART4_UART_Init();

I rechecked the Rx/Tx input into the PCB for the sensor, so I am sure they are the right way round. I am also using the 5V supply on the IoT Discovery Board, which eliminates the DEBO LEV SHIFTER (3.3V<->5V).

But the PCB does not react when I send the messages.

Perhaps the problem is in the way I use the UART commands:

Sending data:

HAL_UART_Transmit(&huart4, msg, sizeof(msg), 1000);

Receiving data:

huart4_status = HAL_UART_Receive(&huart4, pData, sizeof(pData), 1000);

is this correct?