Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMT_TX Module Strange Behaviour When Enabling and Disabling Inside a Method. (IDFGH-14878) #15596

Open
3 tasks done
Dawid-Wawrzynczyk opened this issue Mar 18, 2025 · 2 comments
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@Dawid-Wawrzynczyk
Copy link

Dawid-Wawrzynczyk commented Mar 18, 2025

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

ESP-IDF 5.4.0

Espressif SoC revision.

ESP32-S3

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

ESP32-S3-WROOM-1

Power Supply used.

USB

What is the expected behavior?

Both direct calls and method calls should work the same, at the end of the day, a method is only a fancy wrapper with a name.

Direct:

rmt_disable(channel);
rmt_enable(channel);

Method:

void cancel_rmt_transmission(rmt_channel_handle_t channel) {
    rmt_disable(channel);
    rmt_enable(channel);
}

My RMT module should stop the current transmission and continue onto any other queued transmissions, which can be queued like so:

rmt_transmit(parameters); //transmission 1
rmt_transmit(parameters); //transmission 2
rmt_transmit(parameters); //transmission 3

What is the actual behavior?

The direct call inside my main task where all RMT stuff is done works, correctly. In my case, I have stepper motors which are driven by the RMT module, so when I do:

rmt_disable(channel);
rmt_enable(channel);

Everything works as expected, if the RMT was processing the transmission 1, it should move directly onto transmission 2.

The story is a bit different if I call my method...

void cancel_rmt_transmission(rmt_channel_handle_t channel) {
    rmt_disable(channel);
    rmt_enable(channel);
}

I call the method inside the same task, instead of a direct call:
cancel_rmt_transmission(channel)

And yes the transmission is stopped... but because my RMT drives my motors, I can clearly see that the motors now 'skip' all the other transmissions, instead of following the encoder data which I previously made for them, they just move onto the transmission for a split second, sharply jump into some random position and stop.

Steps to reproduce.

  1. Create an RMT channel
  2. Create a method to cancel the transmission like so:
void cancel_rmt_transmission(rmt_channel_handle_t channel) {
    rmt_disable(channel);
    rmt_enable(channel);
}
  1. Create a FreeRTOS Task which will handle RMT commands. Create a basic loop inside the task like so:
    while (1)
    {
        if (xSemaphoreTake(semaphore, portMAX_DELAY) == pdTRUE)
        {
            //Create some condition on when to start a transmission and when to stop it
            //This will work
            rmt_disable(channel);
            rmt_enable(channel);
            //This won't
            cancel_rmt_transmission(channel);
        }
    }

Debug Logs.


More Information.

Anyone has any idea what's going on here?

I am using the new 'rmt_tx.h' module introduced in ESP-IDF 5.0

@Dawid-Wawrzynczyk Dawid-Wawrzynczyk added the Type: Bug bugs in IDF label Mar 18, 2025
@github-actions github-actions bot changed the title RMT_TX Module Strange Behaviour When Enabling and Disabling Inside a Method. RMT_TX Module Strange Behaviour When Enabling and Disabling Inside a Method. (IDFGH-14878) Mar 18, 2025
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 18, 2025
@suda-morris
Copy link
Collaborator

I can't think of a reason why by calling the rmt_enable/disable directly makes difference from wrapping them inside another function... Maybe the issue locates in a difference place.

What do you mean by "skip"? is the next transmission picked up or not? How did you configure the transmission "loop_count"?

Can you strip your demo to only use a simple copy_encoder and transmit multiple transactions into a queue, calling disable/enable in another function, and attach your logic analyzer to see what is really happen.

@Alvin1Zhang
Copy link
Collaborator

@Dawid-Wawrzynczyk Thanks for reporting, would you please help share if any updates for the issue? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants