esp-idf icon indicating copy to clipboard operation
esp-idf copied to clipboard

bundle code seem to be bugged (IDFGH-13107)

Open ulao opened this issue 1 year ago • 11 comments

Answers checklist.

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

General issue report

OK this is my first bug report, took me a long to to make this work because of all the bugs, I may have figure this out a lot soon but I wan new to it.

If this is the wrong play to report I'm sorry, it was not a runtime bug I think, and not an install bug. Its just a programming bug.

UPDATE: this maybe because I was passing dedic_gpio_del_bundle(&bundleA); not dedic_gpio_del_bundle(bundleA);

dedic_gpio_new_bundle and dedic_gpio_del_bundle do not share the same types for core_id. I tried to set both t int but the struct want uint32_t. I think uint32_t is pointless, there are only 2 CPUs.... Anyways, the core_id is references as uint32_t in most placed but other section of code do not like it set to uint32_t . When I did get most set to in the compare in the delete function compared as core_id: 1 to 1070156032 so it fails and says wrong cpu

2).

using const int bundleA_gpios[] = {0,1,2,3};

allows pins 1,2 and 3 to oscillate .

using const int bundleA_gpios[] = { 1,2,3};

I can not use pin 3, its like the array has to start at 0

3).

if I make a bundle I can not longer use inputs even if I delete it.

I can use this to change input, its much faster then the api.

WRITE_PERI_REG((IO_MUX_GPIO1_REG), (READ_PERI_REG(IO_MUX_GPIO1_REG)|(1<<9))); GPIO.enable_w1tc = ((uint32_t)1 << 1);

but if I created a bundle it no longer works. Even if I delete the bundle it does not work.

Here is some sample code I used.

all of my main tasks are on the main thread and I use this for the bundle code. xTaskCreatePinnedToCore (Start_LLAPI, "none", 4096, (void *)1, 1, NULL, 1);

dedic_gpio_bundle_handle_t bundles[8]; dedic_gpio_bundle_handle_t createBundle( const int arr[], int size, bool makeBundle) { // configure GPIO DEBUG gpio_config_t io_conf;

for (int i = 0; i <size; i++) 
{
    io_conf.intr_type = GPIO_INTR_DISABLE;
    io_conf.mode = GPIO_MODE_OUTPUT;
    io_conf.pin_bit_mask = (1ULL<<i);
    io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
    io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
    gpio_config(&io_conf);
}


// Create bundleA, output only
dedic_gpio_bundle_handle_t bundleA = NULL;
dedic_gpio_bundle_config_t bundleA_config =
{
    .gpio_array = arr,
    .array_size = size,
    .flags = {
    .out_en = 1,
    },
};
if (makeBundle)  dedic_gpio_new_bundle(&bundleA_config, &bundleA);
 return bundleA;

}

void deleteBundle(dedic_gpio_bundle_handle_t bundle) { if (bundle != NULL) dedic_gpio_del_bundle(bundle); }

void Start_LLAPI(void *pvParameter) { const int bundleA_gpios[] = {0,1,2,3}; bundles[0] = createBundle( bundleA_gpios,sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]), false );//use false to no make a bundle. deleteBundle(bundles[0]);

//only works if I do not make a bundle WRITE_PERI_REG((IO_MUX_GPIO1_REG), (READ_PERI_REG(IO_MUX_GPIO1_REG)|(1<<9))); GPIO.enable_w1tc = ((uint32_t)1 << 1); WRITE_PERI_REG((IO_MUX_GPIO2_REG), (READ_PERI_REG(IO_MUX_GPIO2_REG)|(1<<9))); GPIO.enable_w1tc = ((uint32_t)1 << 2);

}

ulao avatar Jun 22 '24 21:06 ulao

Was curios, if its in progress but no assignees is it still being worked?

ulao avatar Sep 13 '24 21:09 ulao

Hi @ulao Sorry for reply late. About you question:

  1. Yes, we delete the bundle by the handle.
  2. Please note the mask when writing or reading the dedic_gpio_bundle. Or you may miss something when configing the GPIO. It works well in my test case.
  3. We allow to use dedic_gpio driver and gpio driver together. It also works well in my test case. Can you tell which chip and which version of IDF you are using? This will help me locate the problem faster.

Kainarx avatar Sep 14 '24 06:09 Kainarx

Oh wow, I took this status to mean it was confirmed and being worked on. Its been so long now checking every day in hopes to see the bug resoled that I do not even remember much about any of this. Looking at my skconfug I see this

Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Configuration

I know I was using the latest chip (s3)

What I remember about the bug was there bundles worked, just not the cleanup and reuse of them. I will need to swtich back and forth in the running code sample.

ulao avatar Sep 14 '24 13:09 ulao

Hi @ulao , here is my test code. createBundle and deleteBundle are your functions. I think there's no problem with the result. Can you have a try and tell me your result? 2024-09-18_15-14

const int bundleA_gpios[] = {0, 1, 2, 3};
dedic_gpio_bundle_handle_t bundles = createBundle(bundleA_gpios, sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]), 1); 

// enable gpio input
WRITE_PERI_REG((IO_MUX_GPIO0_REG), (READ_PERI_REG(IO_MUX_GPIO0_REG) | (1 << 9)));
GPIO.enable_w1tc = ((uint32_t)1 << 0);
WRITE_PERI_REG((IO_MUX_GPIO1_REG), (READ_PERI_REG(IO_MUX_GPIO1_REG) | (1 << 9)));
GPIO.enable_w1tc = ((uint32_t)1 << 1);
WRITE_PERI_REG((IO_MUX_GPIO2_REG), (READ_PERI_REG(IO_MUX_GPIO2_REG) | (1 << 9)));
GPIO.enable_w1tc = ((uint32_t)1 << 2);
WRITE_PERI_REG((IO_MUX_GPIO3_REG), (READ_PERI_REG(IO_MUX_GPIO3_REG) | (1 << 9)));
GPIO.enable_w1tc = ((uint32_t)1 << 3);

dedic_gpio_bundle_write(bundles, 0x0F, 0x0F);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));
printf("dedic_gpio_read:0x%lx\n", dedic_gpio_bundle_read_out(bundles));
dedic_gpio_bundle_write(bundles, 0x0F, 0x00);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));
printf("dedic_gpio_read:0x%lx\n", dedic_gpio_bundle_read_out(bundles));
dedic_gpio_bundle_write(bundles, 0x0A, 0x0F);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));
printf("dedic_gpio_read:0x%lx\n", dedic_gpio_bundle_read_out(bundles));

deleteBundle(bundles);

// enable gpio output
WRITE_PERI_REG(GPIO_FUNC0_OUT_SEL_CFG_REG + (GPIO_NUM_0 * 4), SIG_GPIO_OUT_IDX);
WRITE_PERI_REG(GPIO_FUNC0_OUT_SEL_CFG_REG + (GPIO_NUM_1 * 4), SIG_GPIO_OUT_IDX);
WRITE_PERI_REG(GPIO_FUNC0_OUT_SEL_CFG_REG + (GPIO_NUM_2 * 4), SIG_GPIO_OUT_IDX);
WRITE_PERI_REG(GPIO_FUNC0_OUT_SEL_CFG_REG + (GPIO_NUM_3 * 4), SIG_GPIO_OUT_IDX);
GPIO.enable_w1ts = ((uint32_t)1 << 0);
GPIO.enable_w1ts = ((uint32_t)1 << 1);
GPIO.enable_w1ts = ((uint32_t)1 << 2);
GPIO.enable_w1ts = ((uint32_t)1 << 3);

gpio_set_level(GPIO_NUM_0, 0); gpio_set_level(GPIO_NUM_1, 0); gpio_set_level(GPIO_NUM_2, 0); gpio_set_level(GPIO_NUM_3, 0);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));
gpio_set_level(GPIO_NUM_0, 1); gpio_set_level(GPIO_NUM_1, 0); gpio_set_level(GPIO_NUM_2, 1); gpio_set_level(GPIO_NUM_3, 0);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));
gpio_set_level(GPIO_NUM_0, 0); gpio_set_level(GPIO_NUM_1, 1); gpio_set_level(GPIO_NUM_2, 0); gpio_set_level(GPIO_NUM_3, 1);
printf("gpio_read [0]:%d [1]:%d [2]:%d [3]:%d\n", gpio_get_level(GPIO_NUM_0), gpio_get_level(GPIO_NUM_1), gpio_get_level(GPIO_NUM_2), gpio_get_level(GPIO_NUM_3));

Kainarx avatar Sep 18 '24 07:09 Kainarx

I will, just need to set up the environment again and give it a go.

ulao avatar Sep 18 '24 12:09 ulao

Ok got my head wrapped around this again, first thing I did was verified the issue remains and is does.

then I did a poll and now I have a mess.

first a compile told me to git submodule update --init --recursive so I did now I get

[0/1] Re-running CMake...-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git' -- Could not use 'git describe' to determine PROJECT_VER. -- Building ESP-IDF components for target esp32s3 -- Project sdkconfig file C:/Users/Administrator/Desktop/usb2llapi/usb_host_lib/sdkconfig -- Compiler supported targets: xtensa-esp-elf CMake Error at C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/tool_version_check.cmake:36 (message):

Tool doesn't match supported version from list ['esp-14.2.0_20240906']: C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc.exe

Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first): C:/Users/Administrator/Desktop/esp/esp-idf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/build.cmake:437 (include) C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/build.cmake:669 (__build_process_project_includes) C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/project.cmake:710 (idf_build_process) CMakeLists.txt:8 (project)

-- Configuring incomplete, errors occurred! See also "C:/Users/Administrator/Desktop/usb2llapi/usb_host_lib/build/CMakeFiles/CMakeOutput.log". ninja: error: rebuilding 'build.ninja': subcommand failed

FAILED: build.ninja C:\Users\Administrator.espressif\tools\cmake\3.24.0\bin\cmake.exe --regenerate-during-build -SC:\Users\Administrator\Desktop\usb2llapi\usb_host_lib -BC:\Users\Administrator\Desktop\usb2llapi\usb_host_lib\build

  • The terminal process "C:\Users\Administrator.espressif\tools\ninja\1.11.1\ninja.exe" terminated with exit code: 1.

I did try to run the clean task ecuting task: C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe c:\Users\Administrator\Desktop\esp\esp-idf\tools\idf.py fullclean

Setting IDF_PATH environment variable: C:\Users\Administrator\Desktop\esp\esp-idf The following Python requirements are not satisfied: Error while checking requirement 'psutil'. Package was not found and is required by the application: No package metadata was found for psutil Please follow the instructions found in the "Set up the tools" section of ESP-IDF Getting Started Guide. Diagnostic information: IDF_PYTHON_ENV_PATH: (not set) Python interpreter used: C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe Warning: python interpreter not running from IDF_PYTHON_ENV_PATH PATH: C:\msys64\usr\bin;C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin;C:\WinAVR-20100110\bin___;C:\WinAVR-20100110\utils\bin___;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\dotnet;C:\Program Files\PuTTY;C:\Program Files\Microchip\xc8\v2.36\bin;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;;C:\Users\Administrator.espressif\tools\xtensa-esp-elf-gdb\14.2_20240403\xtensa-esp-elf-gdb\bin;C:\Users\Administrator.espressif\tools\riscv32-esp-elf-gdb\14.2_20240403\riscv32-esp-elf-gdb\bin;C:\Users\Administrator.espressif\tools\xtensa-esp-elf\esp-13.2.0_20240530\xtensa-esp-elf\bin;C:\Users\Administrator.espressif\tools\riscv32-esp-elf\esp-13.2.0_20240530\riscv32-esp-elf\bin;C:\Users\Administrator.espressif\tools\esp32ulp-elf\2.38_20240113\esp32ulp-elf\bin;C:\Users\Administrator.espressif\tools\cmake\3.24.0\bin;C:\Users\Administrator.espressif\tools\openocd-esp32\v0.12.0-esp32-20240318\openocd-esp32\bin;C:\Users\Administrator.espressif\tools\ninja\1.11.1;C:\Users\Administrator.espressif\tools\idf-exe\1.0.3;C:\Users\Administrator.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64;C:\Users\Administrator.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64;C:\Users\Administrator.espressif\tools\esp-rom-elfs\20240305 Constraint file: C:\Users\Administrator.espressif\espidf.constraints.v5.4.txt Requirement files:

  • C:\Users\Administrator\Desktop\esp\esp-idf\tools\requirements\requirements.core.txt Python being checked: C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe

ESP-IDF v5.4-dev-3117-g9b3eda0974

  • The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe c:\Users\Administrator\Desktop\esp\esp-idf\tools\idf.py fullclean" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

but pressing a key and building after does not help.

can you help? Or is this the wrong place.

ulao avatar Sep 19 '24 23:09 ulao

It seems that your toolchain is not up to date and you are missing the psutilf package. You could try execute ./install.sh and then ./export.sh in your IDF path

Kainarx avatar Sep 20 '24 04:09 Kainarx

I use platform io and have no idea how to run those commands. Can I run it from git?

image

ulao avatar Sep 20 '24 17:09 ulao

oh I needed to go to the right path, I ran them both, CMD opened up and closed. I tried to rebuild but same issue.

ulao avatar Sep 20 '24 17:09 ulao

About the environment you can refer the programming guide And you can try to use dedic_gpio_bundle_read_in fucntion instead of reading gpio register

Kainarx avatar Sep 24 '24 04:09 Kainarx

CMakeOutput.log thank you for the info,

"And you can try to use dedic_gpio_bundle_read_in function instead of reading gpio register"--Will then add overhead, I need to conserve as many clock cycles as possible.

I ran the tools installer. At the end it opened up a few command windows that all indicated passed. I had to exit the ide and relaunch it, and it kicked out a few messages about installing. I did a clean. and tried to build. I get what looks to be the same issue. Is there a place in that guide you sent me that I need to focus on? I thought the issues was a tool chain.

`-- Found Git: C:/Users/Administrator/.espressif/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1") -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is GNU 13.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc.exe -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git' -- Could not use 'git describe' to determine PROJECT_VER. -- Building ESP-IDF components for target esp32s3 -- Project sdkconfig file C:/Users/Administrator/Desktop/usb2llapi/usb_host_lib/sdkconfig -- Compiler supported targets: xtensa-esp-elf CMake Error at C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/tool_version_check.cmake:36 (message):

Tool doesn't match supported version from list ['esp-14.2.0_20240906']: C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc.exe

Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first): C:/Users/Administrator/Desktop/esp/esp-idf/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/build.cmake:437 (include) C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/build.cmake:669 (__build_process_project_includes) C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/project.cmake:710 (idf_build_process) CMakeLists.txt:8 (project)

-- Configuring incomplete, errors occurred! See also "C:/Users/Administrator/Desktop/usb2llapi/usb_host_lib/build/CMakeFiles/CMakeOutput.log".

  • The terminal process "C:\Users\Administrator.espressif\tools\cmake\3.24.0\bin\cmake.exe '-G=Ninja', '-DPYTHON_DEPS_CHECKED=1', '-DESP_PLATFORM=1', '-B=c:\Users\Administrator\Desktop\usb2llapi\usb_host_lib\build', '-S=c:\Users\Administrator\Desktop\usb2llapi\usb_host_lib'" terminated with exit code: 1. `

ulao avatar Sep 24 '24 12:09 ulao

If there a better place to get help with this sort of thing, Everything worked so well on the old branch but I can not make it work on the latest code.

ulao avatar Sep 28 '24 20:09 ulao

Tool doesn't match supported version from list ['esp-14.2.0_20240906']:
C:/Users/Administrator/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc.exe

From your log, it looks like you are using windows, it should be that your local toolchain does not match what is required in master. Please update your tools as https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/get-started/windows-setup-update.html

Kainarx avatar Sep 30 '24 06:09 Kainarx

I got a message saying python is missing it directed me here https://dl.espressif.com/dl/esp-idf/

I do not know what version of python I need,. I took a guess and tried python 3.12 but get the same message. I made sure to add the path to the python exe.

From a look at eh installer I previous tried that and just ran it again. I says

  • Starting system check ...
  • Windows version: 10.00.22000 [OK]
  • Checking "Long Paths Enabled" in Windows registry [OK]
  • Active code page: 437
  • Checking certificates
  • https://dl.espressif.com/dl/esp-idf .. [OK]
  • https://github.com/espressif/esp-idf .. [OK]
  • https://www.s3.amazonaws.com/ .. [OK]
  • Detected antivirus: Windows Defender
  • Environment variables (PATHEXT) . [OK]
  • Check complete.

and if I run it it says

Using Python in C:\Espressif\python_env\idf5.4_py3.11_env\Scripts
Python 3.11.2 Using Git in C:\Espressif\tools\idf-git\2.44.0\cmd
git version 2.44.0.windows.1 Activating ESP-IDF 5.4

  • Checking python version ... 3.11.2
  • Checking python dependencies ... OK
  • Deactivating the current ESP-IDF environment (if any) ... OK
  • Establishing a new ESP-IDF environment ... OK
  • Identifying shell ... cmd.exe
  • Detecting outdated tools in system ... Found tools that are not used by active ESP-IDF version. For removing old versions of idf-driver use command 'python.exe C:\Users\Administrator\Desktop\esp\esp-idf\tools\idf_tools.py uninstall' To free up even more space, remove installation packages of those tools. Use option python.exe C:\Users\Administrator\Desktop\esp\esp-idf\tools\idf_tools.py uninstall --remove-archives.

Done! You can now compile ESP-IDF projects. Go to the project directory and run:

but running install still gives my python not installed

ulao avatar Sep 30 '24 12:09 ulao

look like I needed to run install from the esp cmd, not the regular cmd.

after install.bat I get

All done! You can now run: export.bat

after explore.bat I get

Done! You can now compile ESP-IDF projects.

If I close down the IDE and re run it, it tries to update the container and kicks out errors. but I can edit my files locally still and build.

The following Python requirements are not satisfied: Error while checking requirement 'psutil'. Package was not found and is required by the application: No package metadata was found for psutil To install the missing packages, please run "install.bat" Diagnostic information: IDF_PYTHON_ENV_PATH: C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env Python interpreter used: C:\Users\Administrator.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe

There are also two problems

image

ulao avatar Oct 04 '24 16:10 ulao

Does no one understand how any of this works? Everything was working great until I updated.

ulao avatar Nov 02 '24 20:11 ulao

After fishing for outside help the problem was very simple, just delete the .espressif folder and reconfigure the plugin..

but I have to report that this issue is not resolved.

Again, its simple to recreate.

I made some test code to oscillate pins

#define PIN_PULLUP(p) asm volatile ("ee.set_bit_gpio_out %0" : : "I"(p) : );//#define PIN_PULLUP(p) (GPIO.out_w1ts = p) //REG_WRITE(GPIO_OUT_REG, REG_READ (GPIO_OUT_REG) | p)// (GPIO.out_w1ts = (1 << p)) #define PIN_PULLDOWN(p) asm volatile ("ee.clr_bit_gpio_out %0" : : "I"(p) : );//#define PIN_PULLDOWN(p) (GPIO.out_w1tc = p) //REG_WRITE(GPIO_OUT_REG, REG_READ (GPIO_OUT_REG) & ~p)//(GPIO.out_w1tc = (1 << p))

while(1) { PIN_PULLUP(1 << 2);asm volatile ("nop\n nop\n nop\n"); PIN_PULLDOWN(1<<2);asm volatile ("nop\n nop\n nop\n"); PIN_PULLUP(1 << 3);asm volatile ("nop\n nop\n nop\n"); PIN_PULLDOWN(1<<3);asm volatile ("nop\n nop\n nop\n"); PIN_PULLUP(1 << 4);asm volatile ("nop\n nop\n nop\n"); PIN_PULLDOWN(1<<4);asm volatile ("nop\n nop\n nop\n"); _delay_us(10);
};

Simply, the pins go up and down ever 10 us and do so very fast. This will not work without setting up bundles.

to recreate steps steps.

  1. Run my test code above. - nothing shows up on the wire. the pin 1,2, and 3 remain low.
  2. Recompile with the following lines.

const int bundleA_gpois[]={0,1,2,3}; bundles[0] = createBundle( bundleA_gpios,sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]), true );

  1. run code. You will now see the lines oscillating ever 10 us. ( use a fast scope )
  2. add the delete

const int bundleA_gpois[]={0,1,2,3}; bundles[0] = createBundle( bundleA_gpios,sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]), true ); deleteBundle(bundles[0]);

  1. run the code and its still working. A delete should not be working, it should act like step 1

ulao avatar Nov 04 '24 23:11 ulao

I know what you mean. This commit fixed the problem. You can rebase to the latest master to have a try

Kainarx avatar Nov 05 '24 10:11 Kainarx

I did a pull at master and now there seems to be an issue with the master?

Make Error at C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/component.cmake:317 (message): Include directory 'C:/Users/Administrator/Desktop/esp/esp-idf/components/heap/tlsf/include' is not a directory. Call Stack (most recent call first): C:/Users/Administrator/Desktop/esp/esp-idf/tools/cmake/component.cmake:493 (__component_add_include_dirs) C:/Users/Administrator/Desktop/esp/esp-idf/components/heap/CMakeLists.txt:54 (idf_component_register)

ulao avatar Nov 05 '24 13:11 ulao

Maybe you need to update submodule by git submodule update --init --recursive. Anyway, you can just cherry-pick this commit.

Kainarx avatar Nov 05 '24 13:11 Kainarx

yes it now is working correctly, thx for the help We finally got there.

ulao avatar Nov 05 '24 14:11 ulao