This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I am trying to do DMX512 (protocol), I hope to help me, time is very urgent

Hi,

DMX512 protocol is USITT(United States Institute for Theater Technology)Prescribed agreement

I want to follow this agreement to design

============ DMX512 protocol:

Baud:250K

Break:88us

MAB:8us

============ Data frame contains:

Start:1 bit

Data:8 bit

Stop:2 bit

Parity:None

I know that this design will still have errors.

I hope to give me some help, the project is urgent, thanks

Another stop bit need 2 bit, is it necessary to operate directly with registers?

(But the SDK is full of library operations?)

Parents
  • Hi,

    Only UARTE peripheral support two stop bits, and this is only supported on nRF52840 and nRF52810 ICs. Unfortunatelu, there seems to be no support for setting this in the drivers. 

    You can set two stop bits by writing the register directly after initializing the UARTE peripheral:

    NRF_UARTE0->CONFIG |= (UARTE_CONFIG_STOP_Two << UARTE_CONFIG_STOP_Pos);

    The UARTE peripheral have EasyDMA support, meaning transfers can happen in the background while CPU is busy handling BLE/softdevice events. If you frequently need to handle UART events with strict timing requirements, this will not work together with the softdevice.

    Best regards,
    Jørgen

  • I'm not familiar with the protocol details of DMX, but if it have strict timing requirements, an external MCU might be a better solution.

  • hm.... that seems a bit weird idea to implement the "break"... anyways, found this: https://www.nxp.com/docs/en/application-note/AN3315.pdf

    3.1 Software Implementation Because the protocol consists of an untyped byte stream produced by standard UARTs, the implementation can be easily adapted to work with any microcontroller supporting baud rates up to 250 kbps.

    I would put my 5 bucks on the nRF52832 can do this... but I cant jump now to prototyping... need to finish a couple of things before holidays, will see after that how it goes...

  • If that is the case, then I'd agree with you.

    It would also seem sensible that the spec writers would base their protocol on something that can be easily done with standard hardware ...

  • I've been playing around with DMX.  I have DMX transmit pretty much working. One way to handle the initial Break - Mark is to change the baud to 115K and transmit a 00, then change it back to 250K.  I have a 513 byte DMX buffer and it needs to get sent in three pieces because of the DMA 255 byte limit.  If the SoftDevice interrupts in the middle it shouldn't be a problem because the DMX spec only requires that a frame gets completed within one second.  From past experience, many DMX devices will work fine if you just send 1 stop bit, but not all.  So if you need to be able to transmit to any DMX device you need 2 stop bits which means the nRF52832 is not an option.

    Doing a DMX receive looks like it will be more difficult.  It looks like the driver supports notification of a BREAK which can be used to initiate receive of the 513 byte frame.  The problem is if the SoftDevice causes a delay in the start of the receive you could start receiving data in the middle of the frame.  Also, due to the DMA 256 byte limit the receive needs to be split into multiple pieces which makes for more opportunities for errors.  

    Is there a good way to detect if a large delay has occurred or is there a way to chain several DMA operations together to allow a longer stream of uninterrupted data?

  • Other serial peripherals have a EasyDMA array list feature (TWIM, SPIM), but this seems to not be an option for UARTE. However, the .PTR and .MAXCNT registers are double-buffered in the UARTE peripheral. They can be updated and prepared for the next RX/TX transmission immediately after having received the RXSTARTED/TXSTARTED event. This should allow you to setup transfers for up to 510 bytes. If you need more than this, my recommendation would be to use one of the more recent ICs that support longer EasyDMA transfers than nRF52832 for UARTE peripheral. nRF52810 have 10-bit MAXCNT register, while nRF52840 have 16-bit MAXCNT register.

  • Thanks, that gives me two great options.  One more question, nRF52810 sample projects are all pca10040e (emulated) projects. Would a project that is targeted specifically for the pca10032 have any differences.  Can I use a pca10040e project for the starting point?

Reply Children
Related