admin管理员组文章数量:1406950
I am learning to use the esp32 for some projects. I was attempting to set up an rmt channel as per the documentation however when I try to create a new RMT channel I get an invalid argument error here is my code.
#include "driver/rmt_tx.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "esp_err.h"
#include <Arduino.h>
rmt_channel_handle_t tx_chan = NULL;
void setup() {
Serial.begin(9600);
rmt_tx_channel_config_t tx_chan_config = {
.gpio_num = GPIO_NUM_16,
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 1 * 1000 * 1000,
.mem_block_symbols = 4,
};
esp_err_t err = rmt_new_tx_channel(&tx_chan_config, &tx_chan);
if (err != ESP_OK) {
Serial.printf("Error creating RMT TX channel: 0x%x\n", err);
} else {
Serial.println("RMT TX channel created successfully!");
}
}
void loop() {
}
Here is the error I am getting when I upload to my esp32
DE (10) rmt: rmt_new_tx_channel(208): invalid argument
Error creating RMT TX channel: 0x102
If it matters I have a esp32 ESP-WROOM-32 ESP32 ESP-32S Development Board.
I tried making a rx channel to see if that was the issue but it threw the same error
I am learning to use the esp32 for some projects. I was attempting to set up an rmt channel as per the documentation however when I try to create a new RMT channel I get an invalid argument error here is my code.
#include "driver/rmt_tx.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "esp_err.h"
#include <Arduino.h>
rmt_channel_handle_t tx_chan = NULL;
void setup() {
Serial.begin(9600);
rmt_tx_channel_config_t tx_chan_config = {
.gpio_num = GPIO_NUM_16,
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 1 * 1000 * 1000,
.mem_block_symbols = 4,
};
esp_err_t err = rmt_new_tx_channel(&tx_chan_config, &tx_chan);
if (err != ESP_OK) {
Serial.printf("Error creating RMT TX channel: 0x%x\n", err);
} else {
Serial.println("RMT TX channel created successfully!");
}
}
void loop() {
}
Here is the error I am getting when I upload to my esp32
DE (10) rmt: rmt_new_tx_channel(208): invalid argument
Error creating RMT TX channel: 0x102
If it matters I have a esp32 ESP-WROOM-32 ESP32 ESP-32S Development Board.
I tried making a rx channel to see if that was the issue but it threw the same error
Share edited Mar 7 at 0:34 hcheung 4,0983 gold badges15 silver badges27 bronze badges asked Mar 6 at 19:19 turkrkrkrrkrkrkrkrturkrkrkrrkrkrkrkr 93 bronze badges 4 |1 Answer
Reset to default 1The complete rmt_tx_channel_config_t
object should look like this:
rmt_tx_channel_config_t tx_chan_config = {
.gpio_num = GPIO_NUM_16,
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 1 * 1000 * 1000,
.mem_block_symbols = 64,
.trans_queue_depth = 4
};
You are missing the
.trans_queue_depth
setting.The
mem_block_symbols
need to be at least 64 (i.e. 64 * 4 = 256 bytes).
本文标签: arduinotrouble setting up a rmt channelStack Overflow
版权声明:本文标题:arduino - trouble setting up a rmt channel - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744954263a2634264.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
tx_chan_config
that are not being set. As of C++20, the initialization rules for the skipped members rules are well defined, but I can't give any guarantees before that because the Standard doesn't recognize the syntax. – user4581301 Commented Mar 6 at 19:37tx_chan_config
members and make sure all of them are being initialized to valid values. – user4581301 Commented Mar 6 at 19:44