LoRa-E5 Development Kit SMT32WLE5JC ENABLE PORT ENRS485 PB4 USART2

Hi, My name is Raj !
I need to use the RS485 port, from the LORA E5 development kit,
So i need a complete tutorial to activate the TP-485 chip converter and start using it.
Please I need this help as soon as possible.

I have the schematic and it talks about enabling the PB4 with the MXCube software, I already did it!
But something else is missing

I have understood that if I enable the PB4, I could use the RS485 instead of the usart2 but it’s really not very clear and not working

I have also worked on this problem. I am unable to achieve RS485 communication with the dev kit.

  1. The Lora e5 dev kit has the RS485 enable labeled as ‘A4’, while the schematic has it labeled as B4. Probing the board, it seems to be B4, simply mislabeled on the silkscreen of the board.

  2. The voltage to the TP485E chip is only 0.5 - 1.1 V, while the datasheet for this device requires 3V min.

  3. The voltage at the RS485 header is also 0.5-1.1V.

  4. I am powering the board from USB, and the ‘Power test’ line is 3.3V. The other peripherals are also low voltage, 0.5-1.1 V.

  5. I also have the DIO, GND and CLK lines connected to an ST-Link V3. Disconnecting them does not change the potential at the 3.3V vs GND pins on the RS485 header.

  6. The LoraWan example in LoRaWan-E5-Node-qian transmits and receives through a SenseCap gateway to The Things Stack V3. The voltages on the RS485 pins (and other peripherals, like I2C) remain low when I run this example.

I have probable simply neglected a simple step. I appreciate any help that you can provide.

  1. In the schematic by the AP2112K-3.3TRG1, the 3.3 V power to on board peripherals is seen to be controlled by PA9.

  2. Configuring PA9 as output and programming ‘HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);’, results in 3.3 V and RS485 works.

  3. Also note that the power from the Dev Board 5v or 3.3 v output has too much noise to run the rs-485 sensor that I am using (soil moisture and temp). I have had to use a battery or a power supply to get the device to work dependably.

1 Like

In summary:

  1. Configure (I used MX)
    PB4 - Output, for controlling Tx or Rx of the RS485E chip
    PA9 - Output, for controlling power to the 3.3 V peripherals
    UART2 - default, asynchronous, pins PA2 (USART_Tx) and PA3 (USART_Rx).
    PB5 - Output, for LED

  2. Private variables…
    UART_HandleTypeDef huart2;

/* USER CODE BEGIN PV /
__IO uint8_t ubSend = 0;
/
Buffer used for transmission */
const uint8_t aTxBuffer[8] = {0x01, 0x03, 0x00, 0x01, 0x00, 0x02, 0x95, 0xcb};
uint8_t ubNbDataToTransmit = sizeof(aTxBuffer);
__IO uint8_t ubTransmissionComplete = 0;

/* Buffer used for reception */

uint8_t aRxBuffer[9];
__IO uint8_t ubReceptionComplete = 0;
/* USER CODE END PV */

  1. While loop for example…
    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);
    /* USER CODE END 2 */

/* Infinite loop /
/
USER CODE BEGIN WHILE /
while (1)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET); // High to transmit data
HAL_Delay(50);
HAL_UART_Transmit(&huart2, aTxBuffer, ubNbDataToTransmit, 125);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET); // set low to receive data
HAL_UART_Receive(&huart2, aRxBuffer, 9, 100);
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
HAL_Delay(1000);
/
USER CODE END WHILE */

/* USER CODE BEGIN 3 */

}

1 Like

Hi Peter

thanks for documenting your success. I don’t yet fully understand it:

  1. What is MX ?

  2. What is the purpose of the 50ms and1000ms delays ? How low could these be set ?

Do you think it would be feasible to use 2 E5 dev kits to create a wireless RS485 link for exchanging 64 bytes at 5Hz ?

thanks
Michael