Hi,
nRF SDK 16.0, nrf52840
I'm trying to send dmx-512 frames, for that I need to send break and mark after break. For that I need to change baud rate dynamically but it's not happening. The baud rate remains to the set value of 250k. attached is the code. Otherwise the code works fine. See line 15 of the code snippet.
void send_dmx_frame(uint8_t *dmx_data) { uint32_t err_code; // Send Break (Low Voltage) //nrf_gpio_pin_clear(TX_PIN_NUMBER); // Set TX pin low for break duration //nrf_delay_us(88); // Minimum break duration //// Send Mark After Break (High Voltage) //nrf_gpio_pin_set(TX_PIN_NUMBER); // Set TX pin high for MAB duration //nrf_delay_us(8); // MAB duration // Create start sequence with modified baud rate NRF_UART0->BAUDRATE = (UART_BAUDRATE_BAUDRATE_Baud57600 << UART_BAUDRATE_BAUDRATE_Pos); //current_comm_params.baud_rate = UART_BAUDRATE_BAUDRATE_Baud57600; while (app_uart_put(0) != NRF_SUCCESS); // Change the baud rate back to 250k NRF_UART0->BAUDRATE = (UART_BAUDRATE_BAUDRATE_Baud250000 << UART_BAUDRATE_BAUDRATE_Pos); //current_comm_params.baud_rate = UART_BAUDRATE_BAUDRATE_Baud250000; // Send Start Code while (app_uart_put(DMX_START_CODE) != NRF_SUCCESS); // Send DMX channel data for (int i = 0; i < DMX_CHANNEL_COUNT; i++) { while (app_uart_put(dmx_data[i]) != NRF_SUCCESS); } // Send Inter-Frame Gap (IFG) nrf_delay_us(16); // Two Mark Time periods (approximately) //// Wait for data to be transmitted //while (!uart_tx_ready) //{ // // Wait for UART to finish transmitting //} }