dedicated IO bundles issue with more than 8 bits

username
Posts: 535
Joined: Thu May 03, 2018 1:18 pm

dedicated IO bundles issue with more than 8 bits

Postby username » Tue May 31, 2022 1:00 pm

I am puzzled on a issue I am having with using dedicated IO bundles.
https://docs.espressif.com/projects/esp ... cated-gpio

8-bits works just fine, but adding a 9'th gives this in the terminal.
E (433) dedic_gpio: dedic_gpio_new_bundle(214): array size(9) exceeds maximum supported out channels(8)

I did not see anything in the docs that it has to be only 8-bits, and the function below accepts 32-bits. Can we only do 8 bits, or is there a issue with it?
void dedic_gpio_bundle_write(dedic_gpio_bundle_handle_t bundle, uint32_t mask, uint32_t value)


The following code below works just fine when using 8 gpio lines.

Code: Select all

#define OLED_D0	GPIO_NUM_11
#define OLED_D1	GPIO_NUM_12
#define OLED_D2	GPIO_NUM_13
#define OLED_D3	GPIO_NUM_14
#define OLED_D4	GPIO_NUM_21
#define OLED_D5	GPIO_NUM_47
#define OLED_D6	GPIO_NUM_48
#define OLED_D7	GPIO_NUM_45

const int bundleA_gpios[] = {OLED_D0,OLED_D1,OLED_D2,OLED_D3,OLED_D4,OLED_D5,OLED_D6,OLED_D7};

gpio_config_t io_conf = {
    .mode = GPIO_MODE_OUTPUT,
};

// Create bundleA, output only
dedic_gpio_bundle_handle_t bundleA = NULL;
dedic_gpio_bundle_config_t bundleA_config = {
    .gpio_array = bundleA_gpios,
    .array_size = sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]),
    .flags = {
        .out_en = 1,
    },
};

	for (int i = 0; i < sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]); i++) 
	{
    	io_conf.pin_bit_mask = 1ULL << bundleA_gpios[i];
    	gpio_config(&io_conf);
	}


	ESP_ERROR_CHECK(dedic_gpio_new_bundle(&bundleA_config, &bundleA));
    
    // Set all 8 bits high
    dedic_gpio_bundle_write(bundleA,0xff,0xff);
    // Set all 8 bits low
    dedic_gpio_bundle_write(bundleA,0xff,0x00);



This Code breaks it

Code: Select all

#define OLED_D0	GPIO_NUM_11
#define OLED_D1	GPIO_NUM_12
#define OLED_D2	GPIO_NUM_13
#define OLED_D3	GPIO_NUM_14
#define OLED_D4	GPIO_NUM_21
#define OLED_D5	GPIO_NUM_47
#define OLED_D6	GPIO_NUM_48
#define OLED_D7	GPIO_NUM_45
#define OLED_DC	GPIO_NUM_10

const int bundleA_gpios[] = {OLED_D0,OLED_D1,OLED_D2,OLED_D3,OLED_D4,OLED_D5,OLED_D6,OLED_D7, OLED_DC };

gpio_config_t io_conf = {
    .mode = GPIO_MODE_OUTPUT,
};

// Create bundleA, output only
dedic_gpio_bundle_handle_t bundleA = NULL;
dedic_gpio_bundle_config_t bundleA_config = {
    .gpio_array = bundleA_gpios,
    .array_size = sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]),
    .flags = {
        .out_en = 1,
    },
};

	for (int i = 0; i < sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]); i++) 
	{
    	io_conf.pin_bit_mask = 1ULL << bundleA_gpios[i];
    	gpio_config(&io_conf);
	}


	ESP_ERROR_CHECK(dedic_gpio_new_bundle(&bundleA_config, &bundleA));
    
    // Set all 8 bits high
    dedic_gpio_bundle_write(bundleA,0x1ff,0x01ff);
    // Set all 8 bits low
    dedic_gpio_bundle_write(bundleA,0x1ff,0x0000);


ESP_morris
Posts: 290
Joined: Wed Sep 05, 2018 6:23 am

Re: dedicated IO bundles issue with more than 8 bits

Postby ESP_morris » Wed Jun 01, 2022 2:16 am

See the SOC_DEDIC_GPIO_OUT_CHANNELS_NUM defined in this file: https://github.com/espressif/esp-idf/bl ... soc_caps.h

Who is online

Users browsing this forum: Google [Bot] and 114 guests