Wednesday, 23 May 2018

Android Studio: /dev/kvm device permission denied

I installed my Android Studio in my Home directory rather than /. So at first I thought I need to somehow do sudo. Then I tried sudo ./studio.sh but it ask me to install the AS again.

This worked for me:

To check the ownership of /dev/kvm use
ls -al /dev/kvm
The user was root, the group kvm. To check which users are in the kvm group, use
grep kvm /etc/group
This returned
kvm:x:some_number:
on my system: as there is nothing left to the final :, there are no users in the kvm group.
To add the user username to the kvm group, you could use
sudo adduser username kvm
which adds the user to the group, and check once again with grep kvm /etc/group.
Log out and back in (or restart), for the permissions to take effect. If you get the message
adduser: The group kvm does not exist.
On Ubuntu 18.04 you need to additionally sudo apt install qemu-kvm.


ref:
https://stackoverflow.com/questions/37300811/android-studio-dev-kvm-device-permission-denied

Thursday, 10 May 2018

Set a PIN to OPEN DRAIN





digitalWriteOpenDrain(byte pin, bool state)
{
    if (state==LOW)
    {
        pinMode(pin, OUTPUT);
        digitalWrite(pin, LOW);
    }
    else //state==HIGH
    {
        pinMode(pin, INPUT); // Getting HiZ output from this pin
        digitalWrite(pin, LOW);
    }
}


ref:
https://electronics.stackexchange.com/questions/28091/push-pull-open-drain-pull-up-pull-down
https://blog.csdn.net/fengyu09/article/details/50317423
http://www.st.com/content/ccc/resource/technical/document/reference_manual/51/f7/f3/06/cd/b6/46/ec/CD00225773.pdf/files/CD00225773.pdf/jcr:content/translations/en.CD00225773.pdf
http://www.st.com/content/ccc/resource/technical/document/datasheet/bc/21/42/43/b0/f3/4d/d3/CD00237391.pdf/files/CD00237391.pdf/jcr:content/translations/en.CD00237391.pdf
https://github.com/particle-iot/firmware/blob/1a0c5a2c204b312ae8c0435728999d6e3f296ead/hal/src/stm32f2xx/gpio_hal.c#L78
https://community.particle.io/t/electron-open-drain-output-gpio/20196/3
https://electronics.stackexchange.com/questions/156930/stm32-understanding-gpio-settings
https://github.com/DFRobot/STM32/blob/master/cores/blunoM3/wiring_digital.c
https://sites.google.com/site/learningeclipsearm/5-using-stm32-std-lib/b-digital-io-pins
http://m.www.cnblogs.com/luckyalan/p/5154829.html



Tuesday, 8 May 2018

PlatformIO Daily Use Practice


(1) Start a new project
             $ platformio init --board uno --board nanoatmega328

If you need to add new board to the existing project please use platformio init again with all boards included.

(2) compile
Just compile:
             $platformio run
or
             $platformio run -e nanoatmega328

(3) flash/upload
             $platformio run -e nanoatmega328 -t upload
The awesome thing about this is that, even if using a CP2102 TTL to USB, it works perfectly.

(4) more...


ref:
http://docs.platformio.org/en/latest/quickstart.html