Вы находитесь на странице: 1из 38

November 2010 Doc ID 18005 Rev 1 1/38

UM1004
User manual
DMX 512 based LED lighting solution
Introduction
This document describes how to use the demonstration firmware for the DMX512
communication protocol for transmitter, receiver, and standalone mode. The USART
(universal synchronous asynchronous receiver transmitter) module of the STM32F103C6
(ARM 32-bit Cortex-M3) microcontroller is used to transmit/receive data via an RS-485
transceiver. This transmitter sends a DMX512 packet with Null start code, according to
DMX512 2008 standard. The board contains the following:
Microcontroller STM32F103C6
USB protection device ESDAULC6-3BP6
Voltage regulator LDS3985XX33
RS485 communication IC, ST485AB
Voltage protection device STBP120
LED driver STCS1A
Figure 1. DMX based LED lighting solution
www.st.com
Contents UM1004
2/38 Doc ID 18005 Rev 1
Contents
1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Setting up the board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Hardware layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 DMX512 communication protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1 DMX512 packet format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 DMX512 transmitter timing values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 DMX512-A receiver timing values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 DMX512 transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1 DMX512 transmitter system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 DMX512 transmitter block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3 MCU block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.4 Flowchart of firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.4.1 Main routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.4.2 Timer2 interrupt routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4.3 Timer3 interrupt routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5 DMX512 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1 DMX512 receiver system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.2 DMX512 receiver block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.3 MCU block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.4 Calculating the current through LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.5 Flowchart of firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.5.1 Main routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.5.2 Timer2 interrupt routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.5.3 USART1 interrupt routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Schematics and bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
UM1004 Contents
Doc ID 18005 Rev 1 3/38
7 Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
List of figures UM1004
4/38 Doc ID 18005 Rev 1
List of figures
Figure 1. DMX based LED lighting solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Figure 2. Top layer layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 3. Timing diagram for DMX512 packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 4. Typical DMX512 transmitter system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 5. Typical DMX512 transmitter circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 6. Block diagram of single DMX512 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 7. MCU block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 8. Main routine flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 9. Timer2 interrupt flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 10. Timer3 interrupt routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 11. Typical DMX512 receiver system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 12. Typical DMX512 receiver circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 13. Block diagram of single DMX512 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 14. MCU block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 15. Main routine flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 16. Timer2 rising edge interrupt flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 17. Timer2 rising edge interrupt flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 18. Timer2 falling edge interrupt flow chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 19. USART1 interrupt flow chart (part 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 20. USART1 interrupt flow chart (part 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 21. Microcontroller section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 22. ST485AB section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 23. DIP switch section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 24. 3.3 V output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 25. JTAG connector section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 26. USB section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 27. STCS1A: LED driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 28. STBP120 section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Figure 29. Jumpers section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Figure 30. Dimming input POT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
UM1004 Features
Doc ID 18005 Rev 1 5/38
1 Features
The DMX512 communication protocol has the following features:
Option of configuring the board in transmitter, receiver, or standalone mode by just
changing the jumpers J1, J2, J3, and J6
STCS1A device for dimming control of the onboard LEDs
Voltage protection device STBP120 for protecting the board from over- or undervoltage
Advanced USB protection device ESDAULC6-3BP6
Option of providing external power supply for Power LEDs or using 5 V power supply
from the output of STBP120
Potentiometer at the transmitter end provides the dimming data to be sent to onboard
LEDs (standalone mode) or LEDs at the receiver end (in RS485 communication mode)
Board running on internal clock source as a clock source (without using crystal)
Mini-B USB connector can be used in transmitter, standalone, or receiver mode if
power for LEDs is supplied separately from an external source. If USB is also used as a
power source, then only a single LED can be driven for receiver and standalone mode.
This document includes the following:
Block diagram overview of the complete solution
STM32 demonstration firmware flow
Schematics and layouts
Getting started UM1004
6/38 Doc ID 18005 Rev 1
2 Getting started
2.1 Package
The STEVAL-ILL030V1 demonstration board package includes the following items:
Hardware content:
Demonstration board STEVAL-ILL030V1
Documentation:
User manual (this document)
Schematics, Gerber files, BOM list
2.2 Setting up the board
Settings for transmitter:
Place the jumper between 2 and 3 of J3 (mode select jumper)
Place the jumper between 1 and 2 of J1 (driver enable jumper)
Place the jumper between 1 and 2 of J2 (receiver enable jumper)
Leave the rest of the jumpers in open state
Settings for receiver:
Place the jumper between 2 and 3 of J3 (mode select jumper)
Place the jumper between 2 and 3 of J1 (driver enable jumper)
Place the jumper between 2 and 3 of J2 (receiver enable jumper)
Place the jumper between 1 and 2 of J6 only at the receiver at the farthest end,
otherwise place between 2 and 3
Leave the rest of the jumpers in open state
Settings for standalone mode:
Place the jumper between 1 and 2 of J3 (mode select jumper)
Leave the rest of the jumpers in open state
Settings for shutdown mode:
Place the jumper between 2 and 3 of J1 (driver enable jumper)
Place the jumper between 1 and 2 of J2 (receiver enable jumper).
If the board is in running condition and the user wants to change the communication mode,
then change the jumper position in the order as specified above. There is no need to reset
the board. In shutdown mode, ST485AB enters shutdown mode and stops consuming
power.
UM1004 Getting started
Doc ID 18005 Rev 1 7/38
2.3 Hardware layout
Figure 2. Top layer layout
DMX512 communication protocol UM1004
8/38 Doc ID 18005 Rev 1
3 DMX512 communication protocol
3.1 DMX512 packet format
DMX512 slots are transmitted sequentially in asynchronous serial format, beginning with
slot 0 and ending with the last implemented slot, up to slot 512 (a maximum of 513 slots).
Prior to the first data slot being transmitted, a reset sequence is transmitted - a break,
followed by a mark after break, and a start code. Valid DMX512 data slot values under a null
start code are from 0 to 255 decimal.
Figure 3. Timing diagram for DMX512 packet
Each listed point describes the numbers shown in Figure 3:
1. Space for break
2. Mark after break
3. Slot time
4. Start time
5. Least significant data bit
6. Most significant data bit
7. Stop bit
8. Stop bit
9. Mark time between slots
10. Mark before break
11. Break to break time
12. Reset sequence
13. DMX512 packet
14. Start code (slot 0, data)
15. Slot 1, data
16. Slot n, data (max 512)
AM07998v1
UM1004 DMX512 communication protocol
Doc ID 18005 Rev 1 9/38
3.2 DMX512 transmitter timing values
The transmitter follows the timing values as given in Table 1.
3.3 DMX512-A receiver timing values
The receiver accepts the data only if all the timing values given in Table 2 are followed.
Table 1. Timing values of DMX512 packet transmitted
Description Min Typical Max Unit
Bit rate 245 250 255 kbps
Bit time 3.92 4 4.08 s
Minimum update time for 513 slots - 22.7 - ms
Maximum refresh rate for 513 slots - 44 - s
Space for break 92 176 - s
Mark after break (MAB)
12 -
<1.00
s
s
Mark time between slots 0 - <1.00 s
Mark before break (MBB) 0 - <1.00 s
Break to break time
1204 -
1.00
s
s
DMX512 packet
1204 -
1.00
s
s
Table 2. Timing values of DMX512 packet received
Description Min Typical Max Unit
Bit rate 245 250 255 Kbps
Bit time 3.92 4 4.08 s
Minimum update time for 513 slots - 22.7 - ms
Maximum refresh rate for 513 slots - 44 - s
Space for break 88 176 - s
Mark after break (MAB)
8 -
<1.00
s
s
Mark time between slots 0 - <1.00 s
Mark before break (MBB) 0 - <1.00 s
Break to break time
1196 -
1.25
s
s
DMX512 packet
1196 -
1.25
s
s
DMX512 transmitter UM1004
10/38 Doc ID 18005 Rev 1
4 DMX512 transmitter
4.1 DMX512 transmitter system
Figure 4 represents a typical DMX512 system.
The multiple receivers are connected to the DMX host in a daisy-chain manner and
every packet goes through every receiver in its entirety
The controller sends the packet to the RS485 transceiver, which transmits the
corresponding differential signal to the DMX512 receiver
The transmitter sends the dimming potentiometer's data in the slot number as specified
by the DIP switch of the transmitter
Each receiver checks its own address using the DIP switch mounted on it and
processes data present in that particular slot number only
The transmitter is programmed with the number of bytes to be transmitted in each
packet.
Figure 4. Typical DMX512 transmitter system
Figure 5. Typical DMX512 transmitter circuit
AM08512v1
Each packet goes through every receiver in the 'daisy-chain'
DMX512 Receiver
1
DMX512 Host
(Transmitter)
DMX512 Receiver
2
DMX512 Receiver
N
N < 513
Each receiver can control one or many light fixtures
AM08513v1
RS-485
Transceiver
Tx
(-) B
(+) A
VCC
5 V
XLR 3-pin
Connector
To Receiver
DMX-
COMMON
DMX +
Microcontroller
Tx
Shielded cable
100
GND
1
2
3
0.1 F
UM1004 DMX512 transmitter
Doc ID 18005 Rev 1 11/38
4.2 DMX512 transmitter block diagram
The block diagram of the DMX512 controller transmitter is shown in Figure 6. The signals
are transmitted with the use of USART_Tx and an I/O pin. It is necessary to send a break
signal at the beginning of each new packet of data. The break signal allows receivers to
synchronize with the DMX transmitter. The USART module available on STM32
microcontrollers has the ability to automatically generate a 12-bit long break signal,
corresponding to 48 sec at 250 k baud. Unfortunately, this is too short for use in a DMX512
application as the protocol requires a minimum length of 92 sec.
Figure 6 shows the alternative hardware method chosen to generate the longer break
signal. A 100 resistor is connected in series with the microcontroller's USART transmit pin
and the other end of the resistor to an I/O pin. With this solution, the break time can be
varied, from 92 sec to 176 sec to meet the DMX protocol break time specification, when
sending a break signal, the I/O pin is driven low. Later, the I/O pin is tri-stated to allow
transmission from the USART to resume.
The dimming data is 8-bits wide, where '0' represents a light off and '255' represent full
intensity. To generate the two stop bits required by the DMX512 protocol, the STM32
USART is configured for 8-bit mode.
The dimming data is stored in a 512-byte buffer (TX buffer), allocated to the RAM memory.
The data is written to or read from the buffer using the indirect addressing registers available
on the microcontroller architecture for linear memory access.
A counter keeps track of the number of bytes transmitted from the buffer. There are 512 data
slots (max possible) in this case. The potentiometer is connected to channel_5 of ADC1. As
ADC is 12-bit ADC, the data read from the potentiometer is 12-bit data, so for converting into
8-bit data, the data is shifted 4 bits to the right.
Figure 6. Block diagram of single DMX512 receiver
AM08105v1
STM32
Microcontroller
DMX -
USARTTX
R
S
4
8
5
T
X
I/O Pin
USART
100O
DMX
ADC1
RS485
Transceiver
To DMX512
Receivers
Pot
DMX512 transmitter UM1004
12/38 Doc ID 18005 Rev 1
4.3 MCU block diagram
A connection to the STM32F10E-EVAL board is shown in Figure 7:
Figure 7. MCU block diagram
USART_Tx pin (PA9) is connected to PA4 through 100 resistance. PA4 is connected to
RS485_Tx of the RS485 transceiver board:
PA4 is configured as push-pull low for sending a break signal with a specified duration
and is then configured in tri-stated mode
The break signal time is defined by TIM2
The USART_Tx pin (PA9) is used for sending start code and data
Mark time between slots is defined by TIM3
PA5 is configured as analog input and ADC1 is configured as scan with continuous
conversion mode. DMA is used for getting the analog converted data directly into the
internal RAM.
AM08127v1
G
P
I
O

U
S
A
R
T
1

T
x

PA9
Signal RS485TX
to RS485
Transceiver
PA4
STM32F10E
EVAL Board
100O
A
D
C
1

PA5
UM1004 DMX512 transmitter
Doc ID 18005 Rev 1 13/38
4.4 Flowchart of firmware
4.4.1 Main routine
Figure 8. Main routine flow chart
AM08128v1
START
Configure the Microcontroller
Configure the USART
at baud rate of
250kbps
Configure the Timer2 for generating reset
sequence and enable interrupt for CC1 and
update event. Ti mer3 in the OC mode for
generating mark time between slots and enable
update interrupt
Configure the ADC1 with DMA for
reading potentiometer value to control
the dimming values to be sent
Send reset sequence (Configure PA4
push-pull O low and enable TM2)
Delay added to get
the required Break to
Break time
Send reset sequence and update dimming
data from potentiometers in the array
location as specified by
DP Switch
DMX512 transmitter UM1004
14/38 Doc ID 18005 Rev 1
4.4.2 Timer2 interrupt routine
Figure 9. Timer2 interrupt flow chart
AM08129v1
Clear update and
CC1 interrupt
s TM2
update
interrupt?
Disable TM2 and reset counter
Send null start code
Yes
No
Enable TM3
Configure PA4
in floating mode
End
UM1004 DMX512 transmitter
Doc ID 18005 Rev 1 15/38
4.4.3 Timer3 interrupt routine
Figure 10. Timer3 interrupt routine
AM08135v1
Clear update
interrupt
Is no. oI
bytes sent
512?
Send data
Increment byte counter
Yes
No
Disable TIM3
End
DMX512 receiver UM1004
16/38 Doc ID 18005 Rev 1
5 DMX512 receiver
5.1 DMX512 receiver system
Figure 11 represents a typical DMX512 system.
The multiple receivers are connected to the DMX host in a daisy-chain manner and
every packet goes through every receiver in its entirety
At each receiver, the differential signal is received by an RS485 transceiver and given
to the receive side controller
Each receiver is programmed with a specific slot address so it knows which slot it has
to extract from each packet
Figure 11. Typical DMX512 receiver system
There should be only one terminating resistance with a set of receivers and that
terminating resistance should be connected with the farthest receiver from the
transmitter/controller.
Figure 12. Typical DMX512 receiver circuit
AM08512v1
Each packet goes through every receiver in the 'daisy-chain'
DMX512 Receiver
1
DMX512 Host
(Transmitter)
DMX512 Receiver
2
DMX512 Receiver
N
N < 513
Each receiver can control one or many light fixtures
AM08514v1
RS-485
Transceiver
Rx
(-) B
(+) A
VCC
5 V
XLR 3-pin
Connector
From Transmitter
DMX-
COMMON
DMX +
Microcontroller
Shielded cable
GND
1
2
3
0.1 F
Terminator
(Resistance 120 1/4w)
Rx
UM1004 DMX512 receiver
Doc ID 18005 Rev 1 17/38
5.2 DMX512 receiver block diagram
A block diagram of the single DMX512 receiver is shown in Figure 13. The signals are first
received by the RS485 transceiver. The STM32 microcontroller receives the packet through
the USART_RX pin according to the address programmed.
The receiver then extracts a particular slot from the packet and modifies the duty cycle of the
PWM output as per the data received.
Figure 13. Block diagram of single DMX512 receiver
5.3 MCU block diagram
A connection to the STM32F10E-EVAL board is shown in Figure 14:
Figure 14. MCU block diagram
AM08138v1
DMX

STM32
Microcontroller
T
i
m
e
r
3
DMX
-
Tim2 CH2
USART RX
Tim2 CH1
R
S
4
8
5
R
X
RS485
Transceiver
USART

Timer2
LED
driver
PWM OUT
From DMX512
Transmitter
LED
LAMP
AM08139v1

T

M
2
_
C
H
2

PA0
120 Hz PWM
to LED's
T

M
2
_
C
H
1

T

M
3
_
C
H
2

U
S
A
R
T
1
_
R
x

PA10
RS485_RX signal
From RS485
Transceiver
PA1
STM32F10E
EVAL Board
PA6
DMX512 receiver UM1004
18/38 Doc ID 18005 Rev 1
The RS485_RX signal is given to three GPIO pins, PA0, PA1, and PA10. PWM output is
generated on pin PA6.
PA0 is the configured channel1 of timer2. Falling edge input-capture is configured on
this channel
PA1 is the configured channel2 of timer2. Rising edge input-capture is configured on
this channel
PA10 is the configured Rx pin of USART1
PWM of 120 Hz is produced on channel1 of timer3. The duty cycle of PWM is varied
according to the data received.
5.4 Calculating the current through LEDs
The current is set with an external sensing resistor connected to the FB pin. The feedback
voltage is 100 mV, a low resistor value can be chosen for reducing power dissipation. A 0.5A
current is needed so R12 should be selected according to the following equation:
Equation 1
R12
VFB
ILEDs
-----------------
100 mA
0.5 A
--------------------- 200 m = = =
UM1004 DMX512 receiver
Doc ID 18005 Rev 1 19/38
5.5 Flowchart of firmware
5.5.1 Main routine
Figure 15. Main routine flow chart
AM08140v1
No
START
Configure the MCU
Configure the channel 1 & channel 2 of Timer2
in input capture mode with opposite capture
polarity and Timer3 in PWM1 mode to generate
PWM of 120 Hz.
s packet
flag set?
Change the Duty-Cycle of PWM from data slot
as specified by the receivers address
Enable the Receive interrupt of USART1 and
overflow counter interrupt if timer2
Yes
DMX512 receiver UM1004
20/38 Doc ID 18005 Rev 1
5.5.2 Timer2 interrupt routine
Figure 16. Timer2 rising edge interrupt flow chart
AM06796v1
Disable the Channel 2 Rising
Edge nterrupt
s
nitBreakF
lagRx Set?
Store the value of timer counter in MABRisingCounterRx.
Subtract the BreakFallingCounterRx from
MABRisingCounterRx and store the result in TimingCounterRx
Update the value of Ti mingCounterRx on
the basis of GlobalOverflowCount
s
TimingCoun
terRx >
Break time
No
GlobalOverflowCount = 0
Yes
1) Set the Break Flag, nitBreak Flag
and Enable Channel 1 Falling Edge
nterrupt
2) Set MABOverflowCount equal to
GlobalOverflowCount
No
A
Yes
ChanneI 2 Rising Edge Interrupt Routine
UM1004 DMX512 receiver
Doc ID 18005 Rev 1 21/38
Figure 17. Timer2 rising edge interrupt flow chart
AM06797v1
Set Packet Flag
Yes
No
GlobalOverflowCount = (GlobalOverflowCount -
BreakOverflowCount)
Subtract Break Falling Counter Rx from
NextBreak Falling Counter Rx and store the result in
TimingCounterRx. Update the value of TimingCounterRx on
the basis of BreakOverflowCount
Enable Channel 1 Falling Edge
nterrupt and Reset the MAB Flag
Subtract NextBreakFallingCounterRx from
MABRisingCounterRx and store the result in
TimingCounterRx. Update the value of
TimingCounterRx on the basis of BreakOverflowCount
and GlobalOverflowCount
s
TimingCoun
terRx >
Break time
No
Set DataCorrupt Flag
Yes
A
1) Set Break flag and nitBreak Flag
2) BreakFallingCounterRx = NextBreakFallingCounterRx
s
TimingCounter
Rx > DMX
packet time?
Reset Packet Flag
DMX512 receiver UM1004
22/38 Doc ID 18005 Rev 1
Figure 18. Timer2 falling edge interrupt flow chart
AM08337v1
ChanneI 1 FaIIing Edge Interrupt Routine
Store the value of timer counter in MABFallingCounterRx.
Subtract the MABRisingCounterRxfrom MABFallingCounterRx
and store the result in TimingCounterRx
Update the value of Ti mingCounterRx on the
basis of MABOverflowCount and
GlobalOverflowCount
s Break
Flag Set?
Disable the Channel 1 Falling
Edge nterrupt
Yes
No
GlobalOverflowCount = 0
Reset Break Flag and
nitBreak Flag
Set the MAB Flag and Reset the Break
Flag
s NetCounter
> MAB time?
Yes
UM1004 DMX512 receiver
Doc ID 18005 Rev 1 23/38
5.5.3 USART1 interrupt routine
Figure 19. USART1 interrupt flow chart (part 1)
AM06798v1
Store value of Status Flag of
USART1 in StatusRead flag
Store the value of timer counter
in BreakFallingCounterRx
Are
StatusRead
flag and
Framing error
Flag both Set?
Yes
B
Are Break
flag and MAB
Flag both
Reset?
Yes
No
No
s MAB
Flag
Set?
Store the value of timer counter in
NextBreakFallingCounterRx and
Set BreakOverflowCount equals
GlobalOverflowCount
Yes
Enable Channel2 Rising
Edge nterrupt
DMX512 receiver UM1004
24/38 Doc ID 18005 Rev 1
Figure 20. USART1 interrupt flow chart (part 2)
AM08338v1
Are
StatusRead
flag and
RXNE Flag
both Set?
s
DMXChannel
Count Zero?
No
Yes
s
USART
Data
Zero
Store received data in
buffer and then increment
DMXChannel Count by 1
No
MAB Flag Reset
nitBreak Flag Reset
GlobalOverflowCount = 0
B
Yes
Z
s
DMXChannel
Count < 512?
Z
Yes
Make
DMXChannel
Count zero and
then store received
data in buffer
s MAB flag
Set and
DataCorrupt
flag Reset?
AND
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
U
M
1
0
0
4
2
5
/
3
8
D
o
c

I
D

1
8
0
0
5

R
e
v

1
6 Schematics and bill of material
Figure 21. Microcontroller section
AM06798v1
LED2_PB1
GND
USB_PU_PC13
3V3
OSC_N
GND
nRST
OSC_OUT
3V3
B
O
O
T
1
L
E
D
2
_
P
B
1
3
V
3
G
N
D
BOOT0
BOOT1
USBDP_PA12
JTAG_JTMS_PA13
USBDM_PA11
P
W
M
_
O
U
T
_
P
A
6
DP_SWTCH0_PB13
DP_SWTCH1_PB14
DP_SWTCH2_PB15
RS485RX
DP_SWTCH3_PA8
D

P
_
S
W

T
C
H
4
_
P
B
5
D

P
_
S
W

T
C
H
5
_
P
B
6
D

P
_
S
W

T
C
H
6
_
P
B
7
D

P
_
S
W

T
C
H
7
_
P
B
8
D

P
_
S
W

T
C
H
8
_
P
B
9
MODE_SELECT_PB12
USART_TX_PA9
USART_TX_PA9
R
S
4
8
5
D
E
_
P
B
1
1
R
S
4
8
5
T
X
RS485RX
D

M
M

N
G
_

/
P
_
P
A
5
L
E
D
1
_
P
B
1
0
GND
3V3
G
N
D
3
V
3
3V3
B
O
O
T
0
J
T
A
G
_
J
T
D
O
_
P
B
3
J
T
A
G
_
J
N
T
R
S
T
_
P
B
4
J
T
A
G
_
J
T
C
K
_
P
A
1
4
J
T
A
G
_
J
T
D

_
P
A
1
5
OSC_OUT
OSC_N
LED1_PB10
nRST
3V3
HEALTH_CHECK_LED_PB0
P
O
T
_
S
U
P
P
L
Y
_
C
O
N
T
R
O
L
_
P
A
3
R
S
4
8
5
R
E
_
P
A
7
H
E
A
L
T
H
_
C
H
E
C
K
_
L
E
D
_
P
B
0
3V3
3V3
3V3
DNM
Comment: we will use internal RC Clock for board
D1 D1
1
2
R22
330
R22
330
D4
HEALTH CHECK LED
D4
HEALTH CHECK LED R8
100
R8
100
C8
100nF
C8
100nF
C7
100nF
C7
100nF
R7
10k
R7
10k
C6
100nF
C6
100nF
C5
100nF
C5
100nF
R2
0
R2
0
R1
0
R1
0
C9
100nF
C9
100nF
U1
STM32F103C6T6_LQFP48
U1
STM32F103C6T6_LQFP48
PC14_OSC32_N
3
PC15_OSC32_OUT
4
PD0_OSC_N
5
PD1_OSC_OUT
6
NRST
7
VSSA
8
VDDA
9
PA0_WKUP
10
PA1
11
PA2
12
P
A
3
1
3
P
A
5
1
5
P
A
4
1
4
VBAT
1
PC13_ANT1_TAMP
2
P
B
1
1
9
P
A
6
1
6
PB15
28
P
A
7
1
7
P
B
0
1
8
P
B
2
2
0
P
B
1
0
2
1
P
B
1
1
2
2
V
S
S
_
1
2
3
V
D
D
_
1
2
4
PB12
25
PB13
26
PB14
27
PA8
29
PA9
30
PA10
31
PA11
32
PA12
33
PA13
34
VSS_2
35
VDD_2
36
P
A
1
4
3
7
P
A
1
5
3
8
P
B
3
3
9
P
B
4
4
0
P
B
5
4
1
P
B
6
4
2
P
B
7
4
3
V
D
D
_
3
4
8
V
S
S
_
3
4
7
P
B
9
4
6
P
B
8
4
5
B
O
O
T
0
4
4
SW1 SW1
D2 D2
1
2
C1
20pF
C1
20pF
C25
100nF
C25
100nF
R4
1M
R4
1M
R10
330
R10
330
R9
330
R9
330
Y1
8MHz
Y1
8MHz
C2
20pF
C2
20pF
Schematics and bill of material UM1004
26/38 Doc ID 18005 Rev 1
Figure 22. ST485AB section
Figure 23. DIP switch section
AM06800v1
PN_A_ST485ABDR
STBP120_OUT
PN_B_ST485ABDR
STBP120_OUT
RS485DE_PB11
RS485RE_PA7
RS485TX
RS485RX
FLOATING
MOUNT R5 AT THE FARTHEST END
J6
CON3
J6
CON3
1
2
3
C22
100nF
C22
100nF
TP2
TEST PONT
TP2
TEST PONT
1
TP1
TEST PONT
TP1
TEST PONT
1
R5
120
R5
120
R3
500
R3
500
C13
100nF
C13
100nF
+ C21
10uF
+ C21
10uF
R6
500
R6
500
U2
ST485ABDR_SO-8
U2
ST485ABDR_SO-8
RO
1
B
7
RE
2
A
6
DE
3
GND
5
D
4
VCC
8
C24
1uF
C24
1uF
R43
10k
R43
10k
R42
10k
R42
10k
AM06801v1
DP_SWTCH4_PB5
DP_SWTCH5_PB6
DP_SWTCH6_PB7
DP_SWTCH0_PB13
3V3
3V3
DP_SWTCH8_PB9
DP_SWTCH7_PB8
DP_SWTCH1_PB14
DP_SWTCH2_PB15
DP_SWTCH3_PA8
3V3
I
?

I
8
9
4
+
-
R18
100k
R18
100k
R15
100k
R15
100k
R21
100k
R21
100k
R20
100k
R20
100k
R24
100k
R24
100k
R13
100k
R13
100k
R16
100k
R16
100k
R17
100k
R17
100k
R14
100k
R14
100k
SW2
EG-4517-ND
SW2
EG-4517-ND
R19
100k
R19
100k
R25
0
R25
0
UM1004 Schematics and bill of material
Doc ID 18005 Rev 1 27/38
Figure 24. 3.3 V output
Figure 25. JTAG connector section
AM08251v1
USB5V
STBP120_N
3V3 STBP120_OUT
3V3
TP4
TEST PONT
TP4
TEST PONT
1
U4
LDS3985M33R_SOT23-5L
U4
LDS3985M33R_SOT23-5L
VOUT
5
VN
1
B
Y
P
A
S
S
4
NH
3
G
N
D
2
R41
0 OHM /1812
R41
0 OHM /1812
CN1 CN1
3
1
2
R40
0 OHM /1812
R40
0 OHM /1812
TP3
TEST PONT
TP3
TEST PONT
1
+ C12
100uF/10V
+ C12
100uF/10V
R45
10k
R45
10k
+ C14
2.2uF
+ C14
2.2uF
C26
33nF
C26
33nF
AM08252v1
JTAG_JTDO_PB3
RTCK
DBGRQ
DBGACK
JTAG_JNTRST_PB4
JTAG_JTMS_PA13
JTAG_JTCK_PA14
JTAG_JTD_PA15
nRST
3V3
3V3
R31
10k
R31
10k
R36
10k
R36
10k
R28
10k
R28
10k
R27
10k
R27
10k
R30
0
R30
0 CN2
JTAG_CONN
CN2
JTAG_CONN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
R29
10k
R29
10k
R26
10k
R26
10k
R38
10k
R38
10k
R37
10k
R37
10k
Schematics and bill of material UM1004
28/38 Doc ID 18005 Rev 1
Figure 26. USB section
Figure 27. STCS1A: LED driver
AM08136v1
USBDP
USBDP_PA12 USBDP
USBDM USBDM_PA11 USBDM
USB_PU_PC13
USB5V
C17
15pF
C17
15pF
C18
4.7nF
C18
4.7nF
R32
22
R32
22
C16
15pF
C16
15pF
R35
1.5k
R35
1.5k
C15
4.7nF
C15
4.7nF
CN3
USB_MNB TYPE
CN3
USB_MNB TYPE
USB_VCC
1
USBDM
2
USBDP
3
USB_GND
5
SHELL
6
SHELL
7
SHELL
8
D
4
SHELL
9
R34
1M
R34
1M
U5
ESDAULC6-3B6
U5
ESDAULC6-3B6
NC
2
GND
6
/O2
3
/O3
4
/O1
1
N
C
5
R33
22
R33
22
AM08276v1
PWM_OUT_PA6
STBP120_OUT
CATHODE
STBP120_OUT STBP120_OUT
PWM_OUT_PA6
C23
100nF
C23
100nF
R23
10k
R23
10k
U3
STCS1APUR_DFN8
U3
STCS1APUR_DFN8
VCC
1
SLOPE
7
PWM
2
GND
6
EN
3
FB
5
DSC
8
DRAN
4
C10
100nF
C10
100nF
TP7
TEST PONT
TP7
TEST PONT
1
C11
1uF/50V
C11
1uF/50V
TP6
TEST PONT
TP6
TEST PONT
1
+ C20
10uF
+ C20
10uF
R12
200mOHM
R12
200mOHM
R11
500
R11
500
D3
LED
D3
LED
UM1004 Schematics and bill of material
Doc ID 18005 Rev 1 29/38
Figure 28. STBP120 section
Figure 29. Jumpers section
AM08253v1
STBP120_OUT
STBP120_OUT STBP120_N
STBP120_N
R44
10k
R44
10k
C4
1uF
C4
1uF
U6 STBP120_TDFN10 U6 STBP120_TDFN10
NC
1
G
N
D
2
FLT
3
N
4
N
5
OUT
6
OUT
7
NC
9
EN
10
NC
8
C3
1uF
C3
1uF
AM08137v1
STPS_OUT
MODE_SELECT_PB12
GND
GND
CATHODE
3V3
3V3
RS485DE_PB11
GND
PN_A_ST485ABDR
PN_B_ST485ABDR
GND
ANODE
ANODE STBP120_OUT 3V3
RS485RE_PA7
GND
STPS_OUT
SCREW TYPE 3 PN CONN
J3
STANDALONE MODE SELECT
J3
STANDALONE MODE SELECT
1
2
3
J4
LED CONNECTON PNOUTS
J4
LED CONNECTON PNOUTS
1
2
3
4
R39
0 OHM /1812
R39
0 OHM /1812
D8
STPS340U_SMB
D8
STPS340U_SMB
J1
CON3
J1
CON3
1
2
3
D5
LED
D5
LED
D7
LED
D7
LED
J5
CON3
J5
CON3
1
2
3
D6
LED
D6
LED
J2
CON3
J2
CON3
1
2
3
Schematics and bill of material UM1004
30/38 Doc ID 18005 Rev 1
Figure 30. Dimming input POT
AM08254v1
POT_SUPPLY_CONTROL_PA3
DMMNG_/P_PA5
GND WTH STAR CONNECTON
TP5
TEST PONT
TP5
TEST PONT
1
POT1
10K
SET = 0.5
POT1
10K
SET = 0.5
C19
100nF
C19
100nF
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
U
M
1
0
0
4
3
1
/
3
8
D
o
c

I
D

1
8
0
0
5

R
e
v

1
Table 3. BOM
Category
Reference
designator
Component
description
Package Manufacturer
Manufacturers
ordering code /
orderable part
number or
equivalent
Supplier
Supplier ordering
code
Devices
U1
Low-density
performance line, ARM-
based 32-bit MCU with
16 or
32 KB Flash, USB,
CAN, 6 timers, 2 ADCs,
6 communication
interfaces
LQFP48 STMicroelectronics STM32F103C6T6A
U2
Very high speed low
power RS-485/RS-422
transceiver
SO-8 STMicroelectronics ST485ABDR
U3
1.5 A max constant
current LED driver
DFN8(3mmx3mm) STMicroelectronics STCS1APUR
U4
Ultra low drop-low
noise BiCMOS 300 mA
voltage regulator for
use with very low ESR
output capacitor
SOT23-5L STMicroelectronics LDS3985M33R
U5
ESD protection for high
speed interface
SOT-666 STMicroelectronics ESDAULC6-3BP6
U6
Protection device
(CutOff voltage 5.375
volts)
TDFN 10-lead
(2.5 x 2 mm)
STMicroelectronics STBP120AVDK6F
D8 Power Schottky rectifier STPS340U_SMB STMicroelectronics STPS340U
Crystal and
Oscillator
Y1 Quartz crystal 8 MHz
11.35 mm x 4.35
mm, SS4
ECS Inc ECS-80-S-5PX-TR Digi-Key XC1243CT-ND
U
M
1
0
0
4
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
D
o
c

I
D

1
8
0
0
5

R
e
v

1
3
2
/
3
8
Connectors
and jumpers
CN1
Socket, DC power jack,
2.0 MM, right angle,
locking type
Through hole Protectron PDCJ01-08
CN2 JTAG connector
Box header,
straight 20-way,
2x10 pin, 2.54 mm
x 2.54 mm pitch,
through hole
Protectron P9603-20-15-1
CN3 USB MINI-B connector SMD Samtec
MUSB-05-S-B-SM-
A
Digi-Key H2959CT-ND
J1,J2,J3,J6 PinOuts 1x3
Header 2.54 mm x
2.54 mm pitch
Any
J5 Terminal block
3-way vertical
(through hole, pitch
5 mm)
MULTICOMP PA001-3 Farnell 1357319
J4 PinOuts 1x4
Header 2.54 mm x
2.54 mm pitch
Any
Table 3. BOM (continued)
Category
Reference
designator
Component
description
Package Manufacturer
Manufacturers
ordering code /
orderable part
number or
equivalent
Supplier
Supplier ordering
code
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
U
M
1
0
0
4
3
3
/
3
8
D
o
c

I
D

1
8
0
0
5

R
e
v

1
Capacitors
C1,C2 20 pF SMD0805 Any
C3,C4,C11,C
24
1 F/16 V SMD1206 Any
C5,C6,C7,C8,
C9,C10,C13,
C19,C22,C23,
C25
100 nF SMD0805 Any
C12
100 F/10 V mini alum
elect
Leaded Panasonic-ECG ECE-A1AKA101 Digikey P831-ND
C14 2.2 F
Tantalum SMD
EIA 3216-18/Size
A
Any
C15,C18 4.7 nF SMD0805 Any
C16,C17 15 pF SMD0805 Any
C20,C21 10 F SMD0805 Any
C26 33 nF SMD0805 Any
Diodes
D1,D2,D3 LED
Diodes
D4 Health check LED
D5,D6,D7 LED cool white
Avago
technologies
ASMT-MW22-
NNN00
Digi-Key 516-1973-5-ND
D8 STPS340U_SMB
Table 3. BOM (continued)
Category
Reference
designator
Component
description
Package Manufacturer
Manufacturers
ordering code /
orderable part
number or
equivalent
Supplier
Supplier ordering
code
U
M
1
0
0
4
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
D
o
c

I
D

1
8
0
0
5

R
e
v

1
3
4
/
3
8
Resistors
POT1 10 k Panasonic-ECG P3C3103-ND DIgi-Key P3C3103-ND
R7,R26,R27,
R28,R29,R31,
R36,R37,R38,
R42,R43,R44,
R45,R46
10 k SMD0805 Any
R1,R2,R25,R
30
0 SMD0805 Any
R3,R6,R11 500 SMD0805 Any
R4,R34 1 M SMD0805 Any
R5 120 SMD0805 Any
R8 100 SMD0805 Any
R9,R10,R22 330 SMD0805 Any
R12
RES .068 1/4 W 1 %
0805 SMD
SMD0805
Rohm
Semiconductor
MCR10EZHFSR06
8
Digi-Key RHM.068NCT-ND
R13,R14,R15,
R16,R17,R18,
R19,R20,R21,
R24
100 k SMD0805 Any
R32,R33 22 SMD0805 Any
R35 1.5 k SMD0805 Any
R39,R40,R41 0 /2010 SMD2010 VISHAY/dale
CRCW20100000Z0
EF
Digi-Key 541-0.0WCT-ND
Table 3. BOM (continued)
Category
Reference
designator
Component
description
Package Manufacturer
Manufacturers
ordering code /
orderable part
number or
equivalent
Supplier
Supplier ordering
code
S
c
h
e
m
a
t
i
c
s

a
n
d

b
i
l
l

o
f

m
a
t
e
r
i
a
l
U
M
1
0
0
4
3
5
/
3
8
D
o
c

I
D

1
8
0
0
5

R
e
v

1
Switches
SW1
Push-button switch,
SMD
Tactile switch,
SPNO, SMD. 6 mm
x 3.5 mm
MULTICOMP DTSM-32S-B Farnell Part# 9471898
SW2
SW DIP tri-state 9 Pos
unsealed
E-Switch KAT1109E Digi-Key EG4517-ND
Test point
TP1,TP2,TP3,
TP4,TP5,TP6,
TP7
Test points Through hole Protectron P8042-C5-22
Table 3. BOM (continued)
Category
Reference
designator
Component
description
Package Manufacturer
Manufacturers
ordering code /
orderable part
number or
equivalent
Supplier
Supplier ordering
code
Reference UM1004
36/38 Doc ID 18005 Rev 1
7 Reference
1. STM32F103x4, STM32F103x6; Low-density performance line, ARM-based 32-bit MCU
with 16 or 32 KB Flash, USB, CAN, 6 timers, 2 ADCs, 6 communication interfaces,
datasheet
UM1004 Revision history
Doc ID 18005 Rev 1 37/38
8 Revision history

Table 4. Document revision history
Date Revision Changes
25-Nov-2010 1 Initial release.
UM1004
38/38 Doc ID 18005 Rev 1


Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (ST) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to STs terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN STS TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USERS OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
2010 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan -
Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com

Вам также может понравиться