Exploring the Embedded Controller

Absolutely. Sorry about the delay in replying! I’ll get that done this weekend.

Nah, nothing wrong with it at all. Sometimes having too much data can make us worry! Pierce is correct though, you should start a new thread if you’re worried.

Wow! Absolutely, that would be so cool. You may actually prefer to adapt comm-lpc rather than comm-win32, as it implements the LPC protocol over native port I/O. It’s not built into the Windows version, but you could bang the two together until you have something.

It should (???) also support the MEC EC in the Framework Laptop 11th gen. If it doesn’t, I’ve dropped a patch somewhere along the way.

Unfortunately, the modern devices don’t expose support for red on the power LED. That having been said, you still shouldn’t get that error. Can you check whether the module cros_ec_lpcs is loaded? If not, no EC communication will work. :slight_smile:

Thomas has been helping out reviewing my patch series’ as well. His approach is a bit different from mine: where I want to put together a framework-specific platform driver, he wants to expose things that every ChromeOS EC laptop can do and then add a framework-specific driver for the things that not all of the aforementioned laptops can. I’m really looking forward to his work landing! However, it may be best to discuss it in a different thread.

2 Likes

I made a new thread, and it’s clearly something wrong with the battery, the charging speed is reduced 80% when the room temperature is 20 degrees , meaning it could take 4.5 to 5.5 hours to fully charge it. The very clear “wrong” is the “Desired Current” is very, very low, only 783mA

Desired current         783 mA

We need an official explanation of this

I am trying to get ectool working to more thoroughly test an issue I am having with the fan sound of my GPU module in my Framework 16.

I am running into this issue:

$ ./ectool version
Cannot open lockfile /run/lock/cros_ec_lockCould not acquire GEC lock.
$ sudo ./ectool version
Place your right index finger on the fingerprint reader
Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC

I disabled secure boot in the settings and erased my secure boot but I am still running into this error.

This is using the ectool built from the framework EmbeddedController github. I am running on fedora 40.

Any tips to get ectool working?

EDIT: I downloaded your build of ectool from your gitlab repo and got things working!

Just get the prebuilt Linux x64 version from the Artifacts section of the GitLab repo:
https://gitlab.howett.net/DHowett/ectool/-/jobs/899/artifacts/download?file_type=archive

P.S. I have latest Ubuntu 24.04 and the binary works there.

$ sudo artifacts/_build/src/ectool pwmgetfanrpm all
Fan 0 RPM: 2184
$ sudo artifacts/_build/src/ectool temps all
--sensor name -------- temperature -------- ratio (fan_off and fan_max) --
local_f75303@4d       315 K (= 42 C)           6% (313 K and 343 K)
cpu_f75303@4d         312 K (= 39 C)           0% (319 K and 327 K)
ddr_f75303@4d         315 K (= 42 C)        N/A (fan_off=401 K, fan_max=401 K)
cpu@4c                313 K (= 40 C)           0% (376 K and 378 K)

Yup, I edited my post after I figured that out last night.

Hey @DHowett, I was very busy doing other things, but I found some free time this Saturday and I finally managed to rewrite comm-lpc to use WinRing0 and now ectool finally works with Secure Boot enabled:

Implementation details:

Because the internet is full of various versions of WinRing0 of questionable origin and safety, I decided to take a bit of a different approach. Specifically, I rely on a trusted software called Libre Hardware Monitor, which is an open-source C# app that runs an embedded WinRing0 in the background. What I do is that I hijack that and I connect to their WinRing0 while the Libre Hardware Monitor is running. So all that the user needs to do is to download Libre Hardware Monitor, execute it, and leave it running in the background. Then you can use ectool.exe --interface=winring0 <command> and it will use relay the communication.

I will try to publish a fork of your ectool later, so that you can have a look at the code and possibly merge it and republish it yourself.

8 Likes

FYI, I am waiting for @DHowett to coordinate on how to publish the changes. I noticed that his GitLab repository does not mention a license and I do not seem to have a permission to make a merge request there, so I do not want to publish my changes before that is sorted out. :slight_smile:

1 Like

This is great news for Windows users, looking forward to seeing a package come out of this. Thanks again!

2 Likes

Hey @TomsonTom! Sorry for the delay. I pushed a mirror to GitHub and brought in the BSD 3-clause license from the upstream repo.

Feel free to send in a pull request, and we can discuss it over there! :slightly_smiling_face:

2 Likes

Thank you @DHowett ! Great work on that repo, happy to see it mirrored on GitHub!

Here is the pull request for WinRing0 with Secure Boot:

1 Like

Going to give this a go tomorrow! Really appreciate the work for the windows crowd!

1 Like

I don’t know if this is the right place for this. I was having issues with keylightd so I looked for something about the Error: No such file or directory (os error 2) it was giving me. I came here the find out what was wrong but everyone who got the

Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC

was using AMD but I am on 11th Gen Intel. Does anyone have any ideas on why this is happening.

System:
CPU: 11th Gen Intel i7-1165G7
BIOS: 3.19
OS: EndeavourOS

hello, Sorry if this has been said elsewhere but am i correct in thinking that changing the colour of the power led on the framework 16 isn’t possible?
when i try to change it i get result code 3
i also get code 3 when trying to specify a side which i remeber someone saying isnt do able on the fw 16.
is there any reason why that inst exposed on the newer versions?
and one more thing is it possible to trigger the battery disconnect in ectool rather than limiting the charge can do the same thing as the bios disconnect option?

I notice that Dave Howett’s framework ec page is dated 22-Dec-2022 and so doesn’t mention the AMD Framework 16 laptop. But his ectool does support it.

To save others from figuring out how to compile it - just clone the repo and then follow the commands listed in the .gitlab-ci.yml file. Note: it needs root permissions to work. The command: ectool version gave

RO version:    lotus_v3.4.113353-ec:b4c1fb,os:
RW version:    lotus_v3.4.113353-ec:b4c1fb,os:
Firmware copy: RO
Build info:    lotus_v3.4.113353-ec:b4c1fb,os:7b88e1,cmsis:4aa3ff 2024-03-26 07:08:43 lotus@ip-172-26-3-226
Tool version:  0.0.1-isolate Jul  9 2024 none

DHowett in this discussion mentions the code is Zephyr port of the ChromeOS EC
which I presume is chromiumos ec platform but then links through to some very long complex multi-git extractions to build .

Sigh - it does seem very hard to find the actual EC source code.

Also it seems that the AMD Framework 16 EC datasheet is not freely available - probably have to have a login account at nuvoton to get it…

The good news is that the ectool is working well even if the documentation of the EC and the firmware source is very difficult to obtain.

Also interestingly

ectool chipinfo

gives

Chip info:
  vendor:    Nuvoton
  name:      npcx9m3f
  revision:  00160207
4 Likes

The actual EC source code for the Framework 13/16 AMD models is around here: EmbeddedController/zephyr/program/lotus at lotus-zephyr · FrameworkComputer/EmbeddedController · GitHub

2 Likes

Thanks – I’ve downloaded it - now look at how to build it - seems I need the zmake command as per zephyr build instructions

I have downloaded the chromium code which builds depot_tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/bin:/usr/local/sbin:/usr/local/games:/snap/bin:/home/amw/src/depot_tools export PATH

fetch chromium
cd src && ./build/install-build-deps.sh
gclient sync
  • which took about 12 hours… and gets me the cros_sdk tool but not zmake…

There’s a CMakeLists.txt in their repos, so you should try compiling using cmake.

I’m not sure whether “EndeavourOS” packages the ChromeOS EC drivers by default; you should be able to discover if it does by checking…

  1. Is there a cros_ec_lpcs.ko under /lib/modules?
    • `find /lib/modules -name ‘cros_ec*’
  2. Is /dev/cros_ec present?
    • ls -l /dev/cros_ec
  3. Are the modules throwing any errors?
    • dmesg | grep cros

LEDs

Unfortunately, yes - both of these things have changed with the AMD framework laptops.

The power LED no longer supports anything but white; it was updated for compatibility with the chromebook edition which only supported white.

I suspect they wanted to keep documentation between the models similar.

The side LEDs are treated as one entity, “charge” or “battery”, in the AMD boards and probably any newer boards as well.

Battery

You can issue a battery disconnect manually with ectool batterycutoff.

The machine is not intended to be used with the battery shut down. Do this only for experimentation.

In addition to what @pierce said (thank you!), I wrote up a quick gist explaining how to take a clean Debian install (I used a container, but you can use bare metal or whatever) to a Zephyr build environment. It’s actually terrible.

That gist is here.

If you are trying to build for the Framework Laptop 16 AMD, use lotus anywhere you see the name azalea.

3 Likes

On a FW16 I have:
lsmod |grep cros
cros_ec_lpcs 20480 0
cros_ec 20480 1 cros_ec_lpcs

/dev/cros_ec is not present.
dmesg | grep cros
[ 21.416956] cros_ec_lpcs cros_ec_lpcs.0: EC ID not detected

My guess is the ACPI config is not set up correctly.

For the AMD Framework Laptops, you need to be on kernel 6.11 or greater, or apply the kernel patch here: [PATCH v3 0/4] platform/chrome: cros_ec_lpc: add support for AMD Framework Laptops - Dustin L. Howett