RMT Sync Manager Workarounds/Alternatives
Posted: Sun Nov 17, 2024 8:47 pm
Hi there Been banging my head against the wall for quite some time with the RMT peripheral!
I'm trying to generate 8 signals, grouped into 4 pairs of 2 signals.
Each signal pair should work as follows:
I'm not at my oscilloscope right now, but here's what I'm aiming for for each pair:
My problem lies in synchronising the pairs, as I have found the following hardware limitations:
Board | No. RMT TX Ch. | Sync Manager Supported?
ESP32 | 8 |NO
ESP32-S3 | 4 |YES
ESP32-C3 | 2 |YES
ESP32 has enough RMT channels, but no Sync Manager is not supported on it. I thought perhaps I could get around it by using 2x ESP32-S3s, generating 2x2 signals each, but I could only install one Sync Manager before producing an error: "rmt_new_sync_manager(383): no free sync manager in the group". So it seems as though I will need to look beyond the RMT Sync Manager.
I thought of using " rmt_tx_event_callbacks_t::on_trans_done" to trigger some callback that would handle Channel 2, but I am running my signals in looping mode, and the on_trans_done event is only triggered when I stop transmitting the signal (rmt_disable()), not at the end of each signal loop, as I had hoped. So no luck there.
I then tried using interrupts, hoping to read a rising edge on Channel 1, set a GPIO on Channel2, vTaskDelay() for the pulse width, reset the GPIO on Channel 2, delay for the remainder of the signal. But again I had no luck there, as the smallest delay I could generate was 1ms (would need around 1us resolution). I tried configuring CONFIG_FREERTOS_HZ to the required value of 1000000 Hz (1MHz = 1us tick), but it would constantly reset to 100Hz in sdkconfig (I could however set it to 1000 Hz - still not fast enough at 1ms tick).
Is this interrupt approach a viable approach? Is CONFIG_FREERTOS_HZ the correct variable to be modifying in order to increase the tick rate? Is it possible to configure a 1MHz tick?
More generally, does anyone else have any ideas on how else to generate and synchronise the signal pairs? Would really appreciate any help, thanks in advance! Happy to share code if needed
I'm trying to generate 8 signals, grouped into 4 pairs of 2 signals.
Each signal pair should work as follows:
- Channel 1: Start pulse, then data protocol
- Channel 2: Start pulse, then nothing
I'm not at my oscilloscope right now, but here's what I'm aiming for for each pair:
My problem lies in synchronising the pairs, as I have found the following hardware limitations:
Board | No. RMT TX Ch. | Sync Manager Supported?
ESP32 | 8 |NO
ESP32-S3 | 4 |YES
ESP32-C3 | 2 |YES
ESP32 has enough RMT channels, but no Sync Manager is not supported on it. I thought perhaps I could get around it by using 2x ESP32-S3s, generating 2x2 signals each, but I could only install one Sync Manager before producing an error: "rmt_new_sync_manager(383): no free sync manager in the group". So it seems as though I will need to look beyond the RMT Sync Manager.
I thought of using " rmt_tx_event_callbacks_t::on_trans_done" to trigger some callback that would handle Channel 2, but I am running my signals in looping mode, and the on_trans_done event is only triggered when I stop transmitting the signal (rmt_disable()), not at the end of each signal loop, as I had hoped. So no luck there.
I then tried using interrupts, hoping to read a rising edge on Channel 1, set a GPIO on Channel2, vTaskDelay() for the pulse width, reset the GPIO on Channel 2, delay for the remainder of the signal. But again I had no luck there, as the smallest delay I could generate was 1ms (would need around 1us resolution). I tried configuring CONFIG_FREERTOS_HZ to the required value of 1000000 Hz (1MHz = 1us tick), but it would constantly reset to 100Hz in sdkconfig (I could however set it to 1000 Hz - still not fast enough at 1ms tick).
Is this interrupt approach a viable approach? Is CONFIG_FREERTOS_HZ the correct variable to be modifying in order to increase the tick rate? Is it possible to configure a 1MHz tick?
More generally, does anyone else have any ideas on how else to generate and synchronise the signal pairs? Would really appreciate any help, thanks in advance! Happy to share code if needed