Author Topic: CH32V003 Slow Startup Time  (Read 1363 times)

0 Members and 1 Guest are viewing this topic.

Offline n1kt0Topic starter

  • Newbie
  • Posts: 5
CH32V003 Slow Startup Time
« on: November 20, 2023, 03:54:03 pm »
Hey everyone, I’m trying to interface a CH32V003 J4M6 (SOP8 version) with an I2C touch sensor IC, and I need to send I2C commands to the sensor within 10-15 ms of power on to put the touch sensor into its configuration mode.

After some experimentation, I’ve found that it takes approximately 30 ms for the CH32 to start doing anything after power on. I thought maybe this could be due to slow runtime initialization code or long delays waiting for the PLL to lock, so I wrote a bare assembly program that immediately sets up RCC and GPIO registers so I can toggle a GPIO pin (using the 24MHz builtin RC oscillator), but I still see about 28 ms between between power to the IC and the GPIO actually toggling.

My test setup consists of nothing more than a CH32 chip with a 100 nF decoupling cap between power and ground and some header pins I can attach probes to. I’m using a Digilent Analog Discovery 2 in logic analyzer mode to take measurements.

Is this chip just slow to start up, or does anyone have any ideas how I could get it to start up faster?
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5914
  • Country: es
Re: CH32V003 Slow Startup Time
« Reply #1 on: November 20, 2023, 06:14:02 pm »
From datasheet: Power-on reset is 17ms.
Which i2c sensor is that? Do you really have to initialize it within 15ms, blocking configuration otherwise?
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline woofy

  • Frequent Contributor
  • **
  • Posts: 334
  • Country: gb
    • Woofys Place
Re: CH32V003 Slow Startup Time
« Reply #2 on: November 20, 2023, 06:14:42 pm »
What a curious i2c sensor that requires config within 15mS of power up.
Can you post a data sheet?

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: CH32V003 Slow Startup Time
« Reply #3 on: November 20, 2023, 10:42:53 pm »
Yes, that is odd regarding the I2C device, and I suspect the OP is misreading its datasheet.

With that said, 17 ms of startup time is not too bad actually. Try that with an ESP32. :popcorn:
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4040
  • Country: nz
Re: CH32V003 Slow Startup Time
« Reply #4 on: November 21, 2023, 12:23:13 am »
With that said, 17 ms of startup time is not too bad actually. Try that with an ESP32. :popcorn:

I expect you'll recall that Gigadevice's Arm and RISC-V GD32*F103 MCUs take about 130 ms to start up (or wake from the deepest sleep) as they copy in-package but separate die cheap slow flash into SRAM.

How long for ESP32? And which one?
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: CH32V003 Slow Startup Time
« Reply #5 on: November 21, 2023, 12:52:05 am »
With that said, 17 ms of startup time is not too bad actually. Try that with an ESP32. :popcorn:

I expect you'll recall that Gigadevice's Arm and RISC-V GD32*F103 MCUs take about 130 ms to start up (or wake from the deepest sleep) as they copy in-package but separate die cheap slow flash into SRAM.

How long for ESP32? And which one?

Depends on many factors including code size and version of ESP32, I've personally only worked with the -C3, but heard about similar startup times with the -S2/-S3.
It can be anything from about 100 ms to 300 ms+. Some have reported over 500 ms.
And since their "deep sleep" state requires a full "boot" at wake-up, this startup time can be a pretty significant issue for low-power applications.

 

Online HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: gb
Re: CH32V003 Slow Startup Time
« Reply #6 on: November 21, 2023, 02:25:08 am »
If OP really does need to configure the sensor IC within 15 ms of power-on, then perhaps the best solution is to (if possible) control power to the sensor with the MCU. Switch it using a P-channel MOSFET, or similar.

Another solution could be, if the sensor has a reset line, to control that with the MCU. Hold it in reset until you're ready to configure it. Would need to use an external pull-up/down resistor as appropriate to hold it in reset during MCU power-up, until the MCU can override.
 

Offline n1kt0Topic starter

  • Newbie
  • Posts: 5
Re: CH32V003 Slow Startup Time
« Reply #7 on: November 21, 2023, 02:53:35 am »
The touch sensor is an Azoteq IQS211B. When the chip first powers up, there is a brief window where you can access debug/programming settings through an I2C interface before it kicks over to whatever operating mode has been burned into its OTP memory. The chips that I have are unprogrammed and default to outputting touch detection and motion detection logic signals on the two IO pins if they aren't put into I2C mode right at the start.

I had no idea MCUs could take so long to start up.

Oh well, worst case, I can just burn an OTP configuration that enables the I2C interface full time or just control power to the touch sensor from my microcontroller.

Thank you for the responses!
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: CH32V003 Slow Startup Time
« Reply #8 on: November 21, 2023, 03:04:53 am »
As HwAoRrDk suggested, if you really need to access it within a certain time after it powers up, just control its power from the MCU with a power switch.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3727
  • Country: us
Re: CH32V003 Slow Startup Time
« Reply #9 on: November 21, 2023, 07:36:44 am »
That touch sensor has low enough draw to  be powered directly from a GPIO you don't even need an external PFET switch.
 

Offline jlsilicon

  • Newbie
  • Posts: 9
  • Country: us
Re: CH32V003 Slow Startup Time
« Reply #10 on: April 26, 2024, 03:30:36 pm »
Can you post the code for this ?
- It would be helpful for Debugging & Analysis.
I would like to see the I2C code used here.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf