0
\$\begingroup\$

I have two device ( ISL83485 + STM32), and they connected on RS485 line.

I want to send some UART signal to RS485 line with a tranceiver. I am using ISL83485 tranceiver for this purpose, I am using stm32f4 proccessor. When I transmit data under UART2, I can see the data in UART_TX pin of the tranceiver with the osciloscope. If the both device send data to line, I can see RS485 signal on the line, but if the one of them send transmit and another listen or quiet, I couldnt see any data on the RS485 line.

When the other device listen mode, I configured to DE pin as a RESET. But it didnt work. My Connections details:

ISL83495 | STM32 
  RO       USART2_RX
  DI       USART2_TX
  RE       PD3
  DE       PD4
  VCC      3.3V
  B/Z      RS485-TX-N line
  A/Y      Rs485-TX-P line
  GND      GND

between the A-B line I have 120ohm

Source Code:

uint8_t rs485TxBuffer[2]={0xAA,0xBB};
uint8_t rs485RxBuffer[2] ={0x00, 0x00};
..
int main()
{
..
    while(1){
    
            RS485_Set_Transmit_Mode();
            while(HAL_UART_Transmit_IT(&huart2, (uint8_t*)rs485TxBuffer, 2) != HAL_OK)
            {
                // ...
            }
            uartReady = RESET;
            while (uartReady != RESET);
            uartReady = RESET;
            RS485_Set_Receive_Mode();
            while (HAL_UART_Receive_IT(&huart2, (uint8_t*)rs485RxBuffer, 2) != HAL_OK)
            {
                  // ...
            }
            while (uartReady != RESET);
}
void RS485_Set_Transmit_Mode(void)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, SET); // DE pin
}

void RS485_Set_Receive_Mode(void)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, RESET); // DE pin

}

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *UartHandle)
{

uartReady = SET;
}

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{

uartReady = SET;
}

HAL_UART_TxCpltCallback working correctly and I can see the dataon UART_TX line but I couldnt see this data in RS485 line. What is the problem here?

\$\endgroup\$
10
  • 4
    \$\begingroup\$ please draw a schematic diagram of the stm32f4 and ISL83485 connections \$\endgroup\$ – jsotola May 5 at 14:58
  • \$\begingroup\$ I added some connections details in topics, I couldnt add sch. because i have a problem in my computer sorry for this. \$\endgroup\$ – gogogo May 6 at 5:34
  • \$\begingroup\$ You can edit the post and use the integrated schematic editor. shortcut 'Ctrl-M'. \$\endgroup\$ – Tirdad Sadri Nejad May 6 at 5:58
  • \$\begingroup\$ Isn't that enough, I added my codes ? \$\endgroup\$ – gogogo May 6 at 6:37
  • \$\begingroup\$ Disconnect second device from the RS485 bus and see if you can see any traffic on it now. Only one device should control the bus (assert DE pin) at any given time \$\endgroup\$ – Andrejs Gasilovs May 6 at 7:53
1
\$\begingroup\$

My tranceiver have RE and DE pins so I configured like this:

  // Configure the RS-485 pins:
  GPIO_InitStruct.Pin = GPIO_PIN_3 | GPIO_PIN_4;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);

And I add RE pin to Reset for the transceivers receive mode configurations:

void RS485_Set_Receive_Mode(void)
{
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_3, RESET); // RE pin
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, RESET); // DE pin
}
\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.