espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
897 stars 810 forks source link

esp-at command "AT+DRVPWMINIT" fails (IDFGH-10445) #830

Open YSaietGit opened 1 year ago

YSaietGit commented 1 year ago

Answers checklist.

IDF version.

AT version:2.4.2.0(fb731d2 - ESP32C3 - Aug 25 2022 03:47:31) SDK version:v4.3.2-553-g588436db47 compile time(7f0b5f8):Jun 14 2023 14:08:19 Bin version:2.4.2(MINI-1)

Operating System used.

Windows

How did you build your project?

Other (please specify in More Information)

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

None

Development Kit.

Custom board with chip esp32-c3=mini-1

Power Supply used.

External 5V

What is the expected behavior?

On github repository esp-at, I modified AT version 2.4.2.0 to support AT driver commands:

  1. added line "CONFIG_AT_DRIVER_COMMAND_SUPPORT=y" to file sdkconfig.defaults
  2. In file main.yml replaced all lines with python-version: '3.x' to python-version: '3.8' as suggested in other commits to solve the compilation error.

github compiled the release successfully. I loaded the bin file to the chip and used the following commands: AT+DRVPWMINIT=20000,4,10 AT+DRVPWMDUTY=8

The commands work fine and observed a square wave at correct frequency 20Khz and duty 50% as expected.

I then tried reducing the frequency to 1000 and 10 Hz (anything below 5000Hz). The command fails no square wave or square wave at 79KHz is observed.

AT command doc specifies that frequency 1-80MHz is permitted.

What is the actual behavior?

I then tried reducing the frequency to 1000 and 10 Hz (anything below 5000Hz). The command fails no square wave or square wave at 79KHz is observed.

Steps to reproduce.

use at Command for frequency bellow 5KHz AT+DRVPWMINIT=3000,4,10 AT+DRVPWMDUTY=8

or AT+DRVPWMINIT=1000,4,10 AT+DRVPWMDUTY=8

or AT+DRVPWMINIT=10,4,10 AT+DRVPWMDUTY=8

Debug Logs.

No response

More Information.

No response

ustccw commented 5 months ago

@YSaietGit I apologize for the delayed response. The issue you mentioned regarding the inability to set a lower LEDC timer frequency is due to the AT documentation not being clear enough, which caused this confusion.

In fact, the frequency of the LEDC timer and the duty resolution are inversely related. If you want to set a lower timer frequency, you need to set a higher duty resolution. In your case, you can set the <duty_res> parameter to 14, and <duty> to 8192.

Below is my test with firmware: target-v2.4.2.0.zip

a) 3 KHz

AT+DRVPWMINIT=3000,14,10
AT+DRVPWMDUTY=8192

pwm-3khz

b) 2 KHz

AT+DRVPWMINIT=2000,14,10
AT+DRVPWMDUTY=8192

pwm-2khz

c) 1 KHz

AT+DRVPWMINIT=1000,14,10
AT+DRVPWMDUTY=8192

pwm-1khz

d) 8 Hz

AT+DRVPWMINIT=8,14,10
AT+DRVPWMDUTY=8192

pwm-8hz

could you please have a try.

~