-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use MCU SDK in thud branch or most recent branch #75
Comments
According to @andy-shev
|
alright. |
And for the record I'm not willing to enable it at all. It has a lot of problems, in particular with pin control since the original (Linux kernel) solution is not compatible with upstream. |
what a pity that a 100Mhz quark MCU was abandoned. |
Agree, and unfortunately I can't do anything about it. I can advise, though not recommend to follow it (waste of time for cancelled products if you are not Big Customer), to complain to Intel thru the official channels. |
The idea was brilliant. Would have been great to run Zephyr on the MCU. Maybe it will return in a future product. |
Reasonably~but why we devoted ourself with enthusiasm to maintain this cancelled product(intel edison), and add many new features to it, such as new kernel, patched u-boot, ACPI, 64bit, etc. |
First of all, just for fun and there also few more useful (for me personally as an Intel employee) giveaways. |
me too, just for fun , haha~ |
@andy-shev as I was stuck in acpi,u-boot and kernel, I would like to port the old implement to current , could you mind to help me as a guides. |
@xlla, simplest way is to take PSH "driver" as is from stock image (sources) and compile it in the new kernel environment. It should work like the original one. Somewhere I even had a patch, I can share (tell me your email for that). The pin muxing issue is there, though. That's why enabling pin muxing has much more priority over PSH, besides the fact the PSH is not convenient to use due to absence of Zephyr kernel for it. |
@andy-shev sorry for the late reply, I have sent a email to you. |
I have sent you the patch (it's basically compound of what we used to have in stock kernel. Feel free to clean up and send a PR. Maybe @htot will include it in the kernel. (Note, it's not upstreamable material from my perspective, though you always may try to go directly to upstream with it) |
I have compiled it into kernel, flash to ota partition and boot from sdcard. Kernel command line: "tty1=console=ttyS2,115200n8 root=/dev/mmcblk1p1 rootfstype=ext4 systemd.unit=multi-user.target hardware_id=00" Magic signature found Starting kernel ... Application available at (physical) address 0x04819000 VRL mapped to 0xff217000 App size = 11508 bytes App Authentication feature is disabled! Resetting IPC *** Ready to receive application *** Poky (Yocto Project Reference Distro) 2.7.3 edison ttyS2 cpu load up to 43% and keep on. Mem: 161068K used, 816884K free, 576K shrd, 8356K buff, 104880K cached CPU: 4% usr 54% sys 0% nic 0% idle 41% io 0% irq 0% sirq Load average: 17.99 17.61 12.77 12/108 750 Mem: 161068K used, 816884K free, 576K shrd, 8356K buff, 104880K cached CPU: 4% usr 52% sys 0% nic 0% idle 43% io 0% irq 0% sirq Load average: 17.99 17.62 12.80 12/108 751 PID PPID USER STAT VSZ %VSZ %CPU COMMAND 89 2 root RW 0 0% 43% [irq/24-intel_ps] 751 661 root R 3764 0% 4% top 656 655 root S 26952 3% 0% (sd-pam) 1 0 root D 26156 3% 0% {systemd} /sbin/init tty1=console=ttyS2,115200n8 root=/dev/mmcblk1p1 rootfstype=ext4 systemd.unit=m 498 1 root S 22248 2% 0% /usr/sbin/rngd -f -r /dev/hwrng dmesg flood with [ 509.134958] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135010] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135136] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135206] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135344] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135473] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135542] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135593] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135709] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 [ 509.135763] intel_psh_ipc 0000:00:16.0: Ignore message from channel 6 intel_mcu node exist root@edison:~# ls /sys/devices/platform/intel_mcu -al total 0 drwxr-xr-x 4 root root 0 Mar 18 17:38 . drwxr-xr-x 17 root root 0 Mar 18 17:38 .. --w------- 1 root root 4096 Mar 18 17:44 control lrwxrwxrwx 1 root root 0 Mar 18 17:46 driver -> ../../../bus/platform/drivers/intel_mcu -rw-r--r-- 1 root root 4096 Mar 18 17:46 driver_override -r-------- 1 root root 4096 Mar 18 17:42 fw_version -rw------- 1 root root 4096 Mar 18 17:43 log_level -r--r--r-- 1 root root 4096 Mar 18 17:46 modalias drwxr-xr-x 2 root root 0 Mar 18 17:46 power lrwxrwxrwx 1 root root 0 Mar 18 17:38 subsystem -> ../../../bus/platform drwxr-xr-x 5 root root 0 Mar 18 17:38 tty -rw-r--r-- 1 root root 4096 Mar 18 17:38 uevent if I missing something or default mcu app try to send something that new kernel can't understand? |
I upload a simple mcu app just read from tty and print debug info, to avoid involve any mux/pin. I can't get any message from ttymcu0 root@edison:/mnt/sdcard/test# echo debug > /sys/devices/platform/intel_mcu/log_level -sh: echo: write error: Operation not permitted root@edison:/mnt/sdcard/test# cat /sys/devices/platform/intel_mcu/log_level cat: /sys/devices/platform/intel_mcu/log_level: Operation not permitted root@edison:~# cat /dev/ttymcu0 ^C root@edison:~# echo "start" > /dev/ttymcu0 root@edison:~# cat /dev/ttymcu0 ^C root@edison:/mnt/sdcard/test# cat /proc/interrupts | grep intel_psh_ipc 24: 33181819 0 IO-APIC 47-fasteoi intel_psh_ipc |
after clear interrupt flags, no more complain messages, cpu load drop to 0, root@edison:~# cat /proc/interrupts | grep intel_psh_ipc 24: 1 0 IO-APIC 47-fasteoi intel_psh_ipc root@edison:~#top CPU: 0% usr 0% sys 0% nic 99% idle 0% io 0% irq 0% sirq but still can't access log_level root@edison:~# cat /sys/devices/platform/intel_mcu/log_level cat: /sys/devices/platform/intel_mcu/log_level: Operation not permitted root@edison:~# ls -al /sys/devices/platform/intel_mcu/log_level -r--r--r-- 1 root root 4096 Mar 21 18:21 /sys/devices/platform/intel_mcu/log_level |
I don't know how to debug kernel module. |
Bingo! root@edison:~# cat /sys/devices/platform/intel_mcu/log_level debug Many thanks to @andy-shev ! |
Don't forget to send a PR when you get stuff to work! |
look carefully at those logs and compare with source code, the sequence was RANDOM! |
@htot I will. root@edison:~# systemctl status network-gadget-init.service ● network-gadget-init.service - USB Ethernet gadget Loaded: loaded (/lib/systemd/system/network-gadget-init.service; enabled; vendor preset: enabled) Active: inactive (dead) since Mon 2020-03-23 00:17:16 CST; 41s ago Process: 573 ExecStart=/bin/sh -c ifconfig usb0 192.168.2.15 netmask 255.255.255.0 (code=exited, status=255/EXCEPTION) Main PID: 573 (code=exited, status=255/EXCEPTION) Mar 23 00:17:15 edison systemd[1]: Starting USB Ethernet gadget... Mar 23 00:17:15 edison sh[573]: SIOCSIFADDR: No such device Mar 23 00:17:15 edison sh[573]: usb0: ERROR while getting interface flags: No such device Mar 23 00:17:15 edison sh[573]: SIOCSIFNETMASK: No such device Mar 23 00:17:16 edison systemd[1]: network-gadget-init.service: Succeeded. Mar 23 00:17:16 edison systemd[1]: Started USB Ethernet gadget. should I wait some service then launch my service? or add this in to service unit file? ExecStartPre=-/bin/sh -c "echo 'connect' > /sys/class/udc/dwc3.0.auto/soft_connect" another question, when mcusdk upload an app, it will reboot edison; it seems edison must be reboot when mcu app upload, but I notice these is a service will upload mcu app, why that upload do not need a reboot? root@edison:~# systemctl status mcu_fw_loader.service ● mcu_fw_loader.service - Daemon to load edison mcu app binary Loaded: loaded (/lib/systemd/system/mcu_fw_loader.service; enabled; vendor preset: enabled) Active: inactive (dead) since Mon 2020-03-23 00:17:16 CST; 16min ago Process: 582 ExecStart=/etc/intel_mcu/mcu_fw_loader.sh (code=exited, status=0/SUCCESS) Main PID: 582 (code=exited, status=0/SUCCESS) Mar 23 00:17:15 edison systemd[1]: Started Daemon to load edison mcu app binary. Mar 23 00:17:16 edison systemd[1]: mcu_fw_loader.service: Succeeded. If I first power on edison, this service will upload mcu app, then edison need reboot immediately, and the app will upload again, and need another reboot. |
Network: https://edison-fw.github.io/meta-intel-edison/4.2-networking.html#gadget MCU problems: I don't now, never tried, not even with the factory firmware. |
or another service had execute those command auto connmanctl enable gadget services connect gadget_aabbccddeef1_usb each time I power on edison or reboot it, wifi and usb0 was got connected. root@edison:~# connmanctl connmanctl> services *AO wifissid wifi_fc23456cc_6970617135_managed_psk * Wired gadget_aabbccddeef0_usb connmanctl> wifi was fine, since dhcp on router, but usb0 need manual assign IP. |
No that is wrong. usb gets ip from host. But you need to tell host to have dhcp server (shared ip connection). Reed instructions again. Also usb should have power enabled automatically. |
to emulate the original Edison's behavior, I found it was called by udev rules, so I invoke my service from udev rules too, it works. [ OK ] Started Hostname Service. Poky (Yocto Project Reference Distro) 2.7.3 edison ttyS2 edison login: root Last login: Wed Mar 25 00:13:23 CST 2020 on ttyS2 root@edison:~# ifconfig usb0 usb0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:f0 inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::a8bb:ccff:fedd:eef0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:59 errors:0 dropped:0 overruns:0 frame:0 TX packets:43 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:19119 (18.6 KiB) TX bytes:9168 (8.9 KiB) root@edison:~# systemctl status sys-subsystem-net-devices-usb0.device ● sys-subsystem-net-devices-usb0.device - Merrifield USB Device Controller (OTG) Loaded: loaded Active: active (plugged) since Wed 2020-03-25 00:16:19 CST; 38s ago Device: /sys/devices/pci0000:00/0000:00:11.0/dwc3.0.auto/gadget/net/usb0 root@edison:~# systemctl status [email protected] ● [email protected] - USB Gadget ifconfig Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled) Active: active (exited) since Wed 2020-03-25 00:16:20 CST; 1min 1s ago Process: 613 ExecStart=/sbin/ifconfig usb0 192.168.2.15 netmask 255.255.255.0 (code=exited, status=0/SUCCESS) Main PID: 613 (code=exited, status=0/SUCCESS) Mar 25 00:16:19 edison systemd[1]: Starting USB Gadget ifconfig... Mar 25 00:16:20 edison systemd[1]: Started USB Gadget ifconfig. |
Sure, there may be multiple ways to do the same thing:
then after reboot it is already powered, but not connected. For that:
A means autoconnect. |
in my case, after reboot, no need do anything, it is Wired without "A" prefix. root@edison:~# connmanctl connmanctl> services *AO ssid wifi_xxxxx_managed_psk * Wired gadget_aabbccddeef0_usb phone bluetooth_xxxx connmanctl> technologies /net/connman/technology/gadget Name = Gadget Type = gadget Powered = True Connected = False Tethering = False root@edison:~# iperf3 --server ----------------------------------------------------------- Server listening on 5201 on host ==> Pouring iperf3-3.7_1.high_sierra.bottle.1.tar.gz 🍺 /usr/local/Cellar/iperf3/3.7_1: 11 files, 380.4KB rmbp:workspace-mcu xlla$ iperf3 --client 192.168.2.15 Connecting to host 192.168.2.15, port 5201 [ 5] local 192.168.2.20 port 58492 connected to 192.168.2.15 port 5201 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 26.9 MBytes 226 Mbits/sec [ 5] 1.00-2.00 sec 27.0 MBytes 227 Mbits/sec [ 5] 2.00-3.00 sec 26.8 MBytes 225 Mbits/sec |
That's right. In fact you are 'manually assigning an address' but through a script. That means your host doesn't know the address edison or edison.local unless you also add it to /etc/hosts, right? |
yes! that's the original Edison board's behavior, at that time, every tutorial and manual just use that special IP for edison usb ethernet. intel xdk/ mcusdk/iot all are try to connect edison use that IP. |
I see that's fine. Can you create a PR for changing to rndis? |
In my adventure, I'v change a lot of files to get things run, I don't know how to pick them out individually right now, may I create a PR with all of them, or create a clean PR when I have learned how to do that in the future. I will push it here temporary in period. |
I use But I think Andy pointed out you can undo 1 commit with Each commit (git commit) will be done on the files that you added (git add). https://www.atlassian.com/git/tutorials/saving-changes/git-commit We really don't want to have a single commit with everything in it. It's impossible to understand / debug / rollback. |
The ProGit Book is very good and free: https://git-scm.com/book/en/v2 |
Are you still working on this? |
in original firmware, we use tty channels and sysfs nodes to coummunicate with the MCU.
in thud branch, the /dev/ttymcuX is missing, sysfs node /sys/devices/platform/intel_mcu does not exist, only a shell script and a firmware exist
/etc/intel_mcu/mcu_fw_loader.sh
/lib/firmware/intel_mcu.bin
so how can develop a MCU application and upload/debug it ?
The text was updated successfully, but these errors were encountered: