HI all!
I need to control a PWM via potentiameter in anothe project. First I test it in a simple testprogram. When I simulate the program it doesn´t work, I don´t see the PWM on the Graph. I have not test in real word yet, so I don´t know if it work,
What am I do wrong, please?
Br Jorgen
ESP32 PWM!
-
- Posts: 798
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 688 times
- Been thanked: 177 times
-
- Valued Contributor
- Posts: 1616
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 358 times
- Been thanked: 565 times
Re: ESP32 PWM!
Hi Jorgen
The PWM component needs to have a PWM Timer selected and has a period overflow of 255 for 8-bit devices and 65535 for 16-bit devices which also needs to be set according to your device.
I see your slider has a range of 0-4095 so you could perhaps use the Map component to scale to 0-255 for your Duty?
Hope this helps.
Regards
The PWM component needs to have a PWM Timer selected and has a period overflow of 255 for 8-bit devices and 65535 for 16-bit devices which also needs to be set according to your device.
I see your slider has a range of 0-4095 so you could perhaps use the Map component to scale to 0-255 for your Duty?
Hope this helps.
Regards
-
- Posts: 798
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 688 times
- Been thanked: 177 times
Re: ESP32 PWM!
Hi chipfryer27
Many thank´s for your help. Yes I managed to get it work in simulation after your advice. I have compile to chip, no uotput
I use theanalog (warm ) Analog 4 = pin 32 and for the PWM out I use CH4 with pin B3 = D11
Do you have any advice?
Many thank´s for your help. Yes I managed to get it work in simulation after your advice. I have compile to chip, no uotput
I use theanalog (warm ) Analog 4 = pin 32 and for the PWM out I use CH4 with pin B3 = D11
Do you have any advice?

- Attachments
-
- PWM_ESP.fcfx
- (11.53 KiB) Downloaded 520 times
-
- Valued Contributor
- Posts: 1616
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 358 times
- Been thanked: 565 times
Re: ESP32 PWM!
Hi Jorgen
I don't use the ESP32 that much but from what I see with View > Target (showing pins)
I agree that the Slider is connected to IO32 / ADC4 PortB.0 but I'm unsure where you get D11 for the PWM. Is that a typing error?
How are you measuring the output? You will need a scope or an analyser on the pin to see the duty change.
Regards
I don't use the ESP32 that much but from what I see with View > Target (showing pins)
I agree that the Slider is connected to IO32 / ADC4 PortB.0 but I'm unsure where you get D11 for the PWM. Is that a typing error?
How are you measuring the output? You will need a scope or an analyser on the pin to see the duty change.
Regards
-
- Posts: 798
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 688 times
- Been thanked: 177 times
Re: ESP32 PWM!
Hi again!
I disvoverd that if I change the channel I saw that Pin was changing Timer A and B so I try to use Channel 1 and pin A15 then I get fine PWM out
I not managed it by any of the BPins. But anyway, by help from you I can continue my project.
I think it is tricky with pinnumbers with ESP32, no logig
Again thank´s
Br Jorgen
I disvoverd that if I change the channel I saw that Pin was changing Timer A and B so I try to use Channel 1 and pin A15 then I get fine PWM out

I not managed it by any of the BPins. But anyway, by help from you I can continue my project.

I think it is tricky with pinnumbers with ESP32, no logig

Again thank´s
Br Jorgen
- Attachments
-
- PWM_ESP.fcfx
- (11.53 KiB) Downloaded 608 times
-
- Valued Contributor
- Posts: 1616
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 358 times
- Been thanked: 565 times
Re: ESP32 PWM!
Hi

Glad you have it working now.
Regards
It certainly seems that wayI think it is tricky with pinnumbers with ESP32, no logig

Glad you have it working now.
Regards
Re: ESP32 PWM!
I've downloaded the file in https://flowcode.co.uk/forums/viewtopic ... 423#p15423 and changed the target to the ESP32C3_super-mini (compiled it using EDF5.3x).
This gives an error.
According to the schematic and specifications: https://www.sudo.is/docs/esphome/boards ... supermini/ the GPIO's all have PWM capabilities.
But when I compile it I get this error..
What am I doing wrong? Use the wrong pin? Need to choose another pint in the PWM settings?
This example uses the PWM channel 1 component, I don't find that in my component library.
How can I make pin 9 (or any other pin), work as a PWM signal?
At this moment the board is flashing a LED on pin 9 so I know it works and compiles..
This gives an error.
According to the schematic and specifications: https://www.sudo.is/docs/esphome/boards ... supermini/ the GPIO's all have PWM capabilities.
But when I compile it I get this error..
Code: Select all
[3/7] Linking C static library esp-idf\main\libmain.a
[4/7] Generating ld/sections.ld
[5/7] Linking CXX executable esp-project.elf
FAILED: esp-project.elf
cmd.exe /C "cd . && C:\Espressif\tools\riscv32-esp-elf\esp-13.2.0_20240530\riscv32-esp-elf\bin\riscv32-esp-elf-g++.exe -march=rv32imc_zicsr_zifencei -nostartfiles -march=rv32imc_zicsr_zifencei --specs=nosys.specs -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--Map=D:/FC10/ESP/SuperminiPWM/PWM_ESP/build/esp-project.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T rom.api.ld -T esp32c3.peripherals.ld -T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.version.ld -T esp32c3.rom.eco3.ld -T esp32c3.rom.newlib.ld -T memory.ld -T sections.ld @CMakeFiles\esp-project.elf.rsp -o esp-project.elf && cd ."
C:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(esp-project.c.obj): in function `FC_CAL_PWM_Enable_1':
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\ESP/ESP_CAL_PWM.c:221:(.text.FC_CAL_PWM_Enable_1+0x26): undefined reference to `mcpwm_gpio_init'
C:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\ESP/ESP_CAL_PWM.c:223:(.text.FC_CAL_PWM_Enable_1+0x3a): undefined reference to `mcpwm_init'
C:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\ESP/ESP_CAL_PWM.c:225:(.text.FC_CAL_PWM_Enable_1+0x46): undefined reference to `mcpwm_start'
C:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(esp-project.c.obj): in function `FC_CAL_PWM_SetDuty8Bit_1':
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\ESP/ESP_CAL_PWM.c:268:(.text.FC_CAL_PWM_SetDuty8Bit_1+0x40): undefined reference to `mcpwm_set_duty'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Executing action: all (aliases: build)
Running ninja in directory D:\FC10\ESP\SuperminiPWM\PWM_ESP\build
Executing "ninja all"...
Build Failed
Autoclose turned off
This example uses the PWM channel 1 component, I don't find that in my component library.
How can I make pin 9 (or any other pin), work as a PWM signal?
At this moment the board is flashing a LED on pin 9 so I know it works and compiles..
-
- Matrix Staff
- Posts: 1945
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 509 times
- Been thanked: 692 times
Re: ESP32 PWM!
Hello,
Thanks for letting us know. I'll upgrade my IPE to v5.3 and see if I can solve the problem for you. Likely the PWM API has changed slightly in the latest version of the IPE.
Thanks for letting us know. I'll upgrade my IPE to v5.3 and see if I can solve the problem for you. Likely the PWM API has changed slightly in the latest version of the IPE.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel