Access Microcontroller?

Hi, on the VIM3, how does you program the microcontroller onboard? I thought it would appear as something in the Arduino ide or similar. I don’t see any mention of it in the docs

Hello, Do you refer to MCU?

Yes I think so, I’m trying to control power on/off with gpio

The onboard MCU model is STM8S003, you can check the VIM3 Schematic or Specs for the info.

@kenny will response more details later.

Have fun!

Hi qcasey1

  • VIM3 Power control by PWR_EN (MCU pin: PA3), set high to power on, set low to power off, this is control by MCU.

  • when system off, OS(android/linux/…) will sent an I2C command to MCU to cut off system power supply.
    you can try i2ctool Operational command(base on Android):i2cset -f -y 4 0x18 0x80 0x1
    (note: 4 is the i2c bus of VIM3, 0x18 is the mcu address, 0x80 is the mcu reg address, set value 0x1 to mcu reg 0x80 is a poweroff command)

@kenny I think you misunderstood, qcasey1 want a way to control the MCU to power on or off the system, just like Power button.

BTW, @qcasey1 do you know that the XPWR pads which work as as the Power button:

Thanks @davemf for the suggestion.

1 Like

There are several way to power on system:

  • Power Key:it can set to short press or long press to trigger it
  • DCIN: when power plug in, auto power on. it can set to disable
  • IR: press the ir power key. this power key can DIY for yourself IR code,we have reserve two set of key code.
  • GPIO(PA1): this trigger can not work after mcu sleep.
  • RTC: power on after rtc trigger set.
  • WOL: power on after network wake up command

but only one way to tell mcu power off:

  • sent 0x01 to MCU reg 0x80.
1 Like

Thank you both, this has been very helpful!! I appreciate your responses.

If you ever need it, I found this Khadas document on the VIM3’s MCU.


@kenny I’m wondering if it’s possible to control the red and white led via i2c interface? With your method I can control the blue one.

Hi Eurus,
the blue LED is control by MCU(STM8S003F3), the red and white LED control by GPIO of CPU(A311D/S905D3/…),can not use the same way to control at present.

Thanks kenny, I found in the schematics that the white led (sys_led) is linked to GPIOAO_4, and the red one is linked to another controller TCA6408ARGTR.

I first tried to set up GPIOAO_4 with echo 500 > /sys/class/gpio/export, but it gives
bash: echo: write error: Device or resource busy.

I’ve not exported before and there is only export gpiochip410/ gpiochip496/ unexport in /sys/class/gpio/.

I then tried to set up the red led by sending commands like i2cset -f -y 4 0x20 register 0x4f where 0x20 is that chip’s i2c addr, 0x4f is by toggling the fifth bit of its original value, not sure about the register though. I tried to send this commend to every register but to no avail.

Any guidance please?

Ah I was so stupid that I can’t count bit right.
Regarding the red led,
i2cset -f -y 4 0x20 1 0x6b will turn it on
i2cset -f -y 4 0x20 1 0x4b will turn it off.

So what reminds is to access the gpio correctly… @kenny basically I just want the white led to be off when powered on

1 Like

You can control the red led and white led on settings menu

About more information, you can refer to the source code on github

1 Like

Thanks a ton Terry.
I’m on ubuntu, by reading your android code, I figured it out:

echo none | sudo tee /sys/class/leds/sys_led/trigger turns the white led off.

1 Like

So what are the options to switch On the VIM3L

1-> by pressing the default smd mounted power button provided on the board.


[quote=“kenny, post:7, topic:5128”]
DCIN: when power plug in, auto power on. it can set to disable
[/quote] -> Where is the DC In connector? Is this the VIN connector?

3-> IR remote.

So if power supply is there to the VIM3L by usbc - and you give power on /off command via the IR remote, does it go into hibernation? and does it wake from hibernation?
How does the IR remote power function ?

What is the XPWR - if I solder a momentary nc push switch to these pads, it functions same as the default mounted power button ?

Hello, Yes on 1.).
2.) Using KBI, one can set the option . When power is applied to the VIM3L, option to power up or do not power up. Yes, VIN is an alternate power input.
3.) Short press of power button on IR remote powers on the VIM3L, once on, a short press puts it to sleep/wake. Long-press the IR remote power button brings up the shutdown dialog window, from there options are, Shutdown, sleep or reboot. Note: Some firmwares/ROMs have options for what happens when the power button is pressed.
Yes XPWR allows a remote power switch to be used, as you stated.