AN3070 STMICROELECTRONICS | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 12

Technical content

Datasheet sections

  • 1 DE signal timing constraint
  • 2 Description of the methods used to manage the DE signal
  • 2.1 Method using the DMA interrupt
  • 2.2 Method using the USART interrupt
  • 3 Measuring the DE signal switching time using the
  • 3.1 Measuring the DE signal switching time
  • 3.1.1 Measuring the DE signal switching time using the DMA interrupt
  • 3.1.2 Measuring the DE signal switching time using the USART interrupt
  • 4 Conclusion
  • 5 Revision history

January 2010 Doc ID 16312 Rev 1 1/12 AN3070 Application note Managing the Driver Enable signal for RS-485 and IO-Link communications with the STM32™’s USART Introduction RS-485 and IO-Link are half-duplex communication protocols that offer easy ways of implementing the physical layer in industrial networks. The STM32F10x, which comes with up to 5 UART interfaces and features fast DMA transfer and low interrupt latency, meets the RS-485 and IO-Link timing specifications. This application note aims at providing timing measurements of the DE signal (Driver Enable) switching by using two different methods for managing this signal in RS-485 and IO-Link master transmission. The application note is organized into three parts:

  • it first explains why the timing of the DE signal is critical
  • it then describes the two methods used to manage the DE signal
  • and, finally, it gives different measurements of the DE signal switching time

1 DE signal timing constraint

must act in send or receive mode. are sent by the other entity. the bit time that follows the last bit of the last byte sent by the master. Figure 1. DE timing constraint & IO-Link specifications). The DE signal is managed by a GPIO. however any GPIO could be used.

2 Description of the methods used to manage the DE

between the USART send and receive modes. transmit complete interrupt of the USART. transmit buffer empty interrupt.

2.1 Method using the DMA interrupt

enabled. In this interrupt, the DE pin is driven low. The DE signal goes high just before the DMA transfer is enabled. Figure 2. DMA interrupt method to control the DE signal

2.2 Method using the USART interrupt

example of the DE signal management using the USART interrupts. last byte is sent. This is done by enabling the TC interrupt during the last byte transmission. The next occurrence of the transmit complete interrupt drives the DE pin low.

Figure 3. USART interrupt method to control the DE signal

3 Measuring the DE signal switching time using the

and the falling edge of the DE signal. It is measured in CPU clock cycles (refer to Figure 4). Figure 4. Zoom in DE signal switching period CPU cycles the time taken by the DE signal to switch to the low level. (DE signal), send a buffer of 4 bytes and then drive PC6 low. 72 MHz is selected by default.

3.1 Measuring the DE signal switching time

The examples are built with two compilers: Keil™ 4.00 and IAR 5.40. They implement two optimization modes: low optimization and high optimization on timing. The baud rate for transmission is 230400 baud (bit time = 4.34 µs), 1 stop bit.

3.1.1 Measuring the DE signal sw itching time using the DMA interrupt

Table 1 gives the different timings measured at 72 MHz using the DMA interrupt method. Table 2 gives the different timings measured at 24 MHz using the DMA interrupt method.

3.1.2 Measuring the DE signal sw itching time using the USART interrupt

Table 3 gives the different timings measured at 72 MHz using the USART interrupt method. Table 4 gives the different timings measured at 24 MHz using the USART interrupt method. Table 1. Timing measurements of DE switching at 72 MHz Table 2. Timing measurements of DE switching at 24 MHz Table 3. Timing measurements of DE switching at 72 MHz Table 4. Timing measurements of DE switching at 24 MHz

4 Conclusion

This application note presents two methods for managing the DE signal and guaranteeing the timing imposed by the RS-485 & IO-link specifications:

  • The first method uses the DMA transmit complete interrupt and the USART transmit complete interrupt. It is easy to implement, and it leaves the CPU free to perform other tasks.
  • The second method uses the USART interrupt. It does not require the DMA channel and so, can be implemented while the DMA is not available becaused used for other purposes. Compared to the USART interrupt method, the DMA interrupt method achieves lower DE signal switching times. So, if DMA is available for data transmission, it is preferable to use it. The two methods meet the RS-485 & IO-link timing requirement of 230 kbs transfer speed (bit time = 4.34 µs).

5 Revision history

Table 5. Document revision history 11-Jan-2010 1 Initial release.