Skip to main content
Visitor II
July 24, 2017
Question

dmx512 transmitter

  • July 24, 2017
  • 2 replies
  • 2432 views
Posted on July 24, 2017 at 13:22

Hello 

I useing stm32f103c8(72mhz) and i want create DMX512 transmitter for  led lighing.

I have some problem.I config usart like this.

USART_InitStructure.USART_BaudRate = 250000;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_2;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Tx;

USART_Init(USART2, &USART_InitStructure);

when i make reset sequence and data with this code.

_delayus(20);///MarkBeforeBreak

USART_SendBreak(USART2);//Break

_delayus

(12);//MarkAfterBreak;

USART_SendData(USART2,0);///start code

for(int i=0;i<512;i++)

{  

USART_SendData(USART2,255);//R

USART_SendData(USART2,255);//G

USART_SendData(USART2,255);//B

_delayus

(12);//MTBP

}

I have some problem with this code.

1-Break time is 44us but dmx need 92us at least how can solve this problem?

2-Is structure right for dmx led light?

Thanks

    This topic has been closed for replies.

    2 replies

    Visitor II
    July 24, 2017
    Posted on July 24, 2017 at 14:30

    Hi!!

    for the first part:

    by sending more (at least 3) consecutive breaks. Is it permited from protocol?

    Visitor II
    July 24, 2017
    Posted on July 24, 2017 at 15:24

    Hi again

    for the second part. .

    I am nnot familiar with this protocol but you have some UART issues

    Before you send a character or every character by USART_SendData(USARTX,y);

    must check before if DR txbuffer is empty by

    //  SendByte sequence

    while( USART_GetFlagStatus(USART2, USART_FLAG_TXE)==RESET);

    USART_SendData(USART2,data);

    to send two or more  consecutive breaks  must check before ' Break Character' flag

    //check before  the CR1 SBK flag

    while(USART2->CR1 & CR1_SBK_Set);

    USART_SendBreak(USART2);//Break

    while(USART2->CR1 & CR1_SBK_Set);

    USART_SendBreak(USART2);//Break

    Visitor II
    July 25, 2017
    Posted on July 25, 2017 at 13:06

    hello thanks.

    but when i use this code

    while(USART2->CR1 & CR1_SBK_Set);

    USART_SendBreak(USART2);//Break

    break doesn't send at all

    Explorer
    June 27, 2024

    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.

     

    ISHA_0-1719471466245.png