I’m trying to create some code to transmit DMX preferable with DMA. There are a few topics, however there are not any existing libraries so far that work directly out of the box.
There is an application that transmits DMX (that receives ArtNet data), however the code seems unnecessary low-level. However it seems to work on the Particle devices.
Besides that there are other Teensy libraries mentioned that might be a good starting point:
This seems some interesting pseudo code to transmit DMX by using the default Serial implementation (I suppose the STM32 also support a baudrate setting of 250000?):
I’m wondering of DMA is supported on Serial1 (the TX/RX outputs on the Photon)? I know it’s implemented for SPI. It would be nice if we could send out DMX data directly from the memory in the background, while the Photon keeps rendering light data.
I dived in the firmware and it seems that you can enable DMA on Serial1 (which is USART2 if I found it right).
On line 435 of stm32f10x_usart.c
/** * @brief Enables or disables the USARTs DMA interface. * @param USARTx: Select the USART or the UART peripheral. * This parameter can be one of the following values: * USART1, USART2, USART3, UART4 or UART5. * @param USART_DMAReq: specifies the DMA request. * This parameter can be any combination of the following values: * @arg USART_DMAReq_Tx: USART DMA transmit request * @arg USART_DMAReq_Rx: USART DMA receive request * @param NewState: new state of the DMA Request sources. * This parameter can be: ENABLE or DISABLE. * @note The DMA mode is not available for UART5 except in the STM32 * High density value line devices(STM32F10X_HD_VL). * @retval None */
This low-level stuff is (still) a bit difficult to understand for me, so I hope someone can give some hints or pseudo code.