Hi. Just registered. Today I started to play with DietPi. Wonderfull stuff sofar!
I’m wondering if it would be possible to add the hardware related things (enable i2c, spi, …). Also the option to load the driver(s) at boot? Like in the official Wheezy and Jessie Raspbian “distro”? Since the official Jessie image has outgrown an 4 Gb SDcard, I was looking for something smaller. DietPi seems the way to go!
I run the RPi headless, with just an i2c 4x20 LCD and a barcode scanner. I changed a few things in config.txt already (added dtparam=i2c_arm=on) and in cmdline.txt (I want ttyAMA0 as console). But this is not enough yet to get i2c up and running. I do not get the /dev/i2c/ devices.
Another question, will my mods to config.txt and cmdline.txt be overridden during an kernel upgrade?
Tnx
Egbert Jan, NL
I’ll need to look into your query indepth over the next few days and get back to you. But yes, i dont see why we cant add the options you mentioned into DietPi-Config.
There might be additional software that needs to be installed, or more configurations we dont know about. I’ll know more when I look into it.
Another question, will my mods to config.txt and cmdline.txt be overridden during an kernel upgrade?
Not by DietPi.
DietPi treats your config.txt and cmdline.txt file as “yours”. We may add additional options to your config.txt file during updates, however, DietPi will never remove or modify your config.txt settings, unless you set them in dietpi-config.
DietPi-Software will apply some settings to config.txt when you install software. EG: You install Kodi, DietPi will automatically increase GPU memory size in relation to your total memory and what Kodi requires.
In terms of Kernel updates (eg: rpi-update, which is out of our control), i’am yet to see this add/modify config.txt items. Everything should be as you have left it.
Thanks for this swift reply. Since you have already the dietpi-software script, adding a HW group might be added to install rpi-gpio, i2c-tools etc. I like the approach very much; kind off modular, easy to extend.
Things are needed in config.txt for sure but might be added via dietpi-config. That is how raspi-config works (I guess). I bet you looked carefully how raspi-config was put together when you started work on dietpi-config
I’ll try to figure out wat is needed to get my application (written in python) up and running. I need i2c, smbus, gpio and from the distro: build-essential, python, python-dev, python-evdev. probably more. Don’t hold your breath… I’m busy with other things too. If you like, have a look at my wiki: http://wiki.vandenbussche.nl/index.php?title=Price_Scanner.
Replying to myself… A few simple steps to use i2c and python.
To be able to use i2c you need “dtparam=i2c_arm=on” in config.txt and the module “i2c_dev” in /etc/modules. If you want to run the i2c bus at 400 KHz, change the line in config.txt into: “dtparam=i2c_arm=on,i2c_arm_baudrate=400000”. After installing “i2c-tools”, use “i2cdetect -y 1” to see the i2c bus. If thre are any devices on the bus, they will show up with their hex address.
Running pytrhon is just a matter of installing it with apt-get. Depending on your needs, one or more python packages must be installed too. “python-dev” and “python-smbus” come to mind. If you need to add more exotic python libraries, you need “pip” the python installer. Install with “apt-get install python-pip”. Do install “build-essential” too; pip often needs to compile a package. I needed “evdev” and “subprocess32”. Use “pip install evdev subrocess32” to install these.
Dan, this should give you the info howto activate i2c in the DeviceTree, do the load of the related module in “dietpi-config” and to add the python environment to “dietpi-software”. Don’t bother to install all kind of python libraries; python programmers will know what to do.
Excellent, thank you for the information, this will save me many hours of research! Really appreciate it.
I’ve also created a Git ticket for this request: https://github.com/Fourdee/DietPi/issues/98. I’ll implement it when i can. Also, as i dont own any i2c/spi devices for my RPi, i may need your help to test these features when they are completed. I’ll keep you updated.
Good work. I just upgrded to V99. I still had i2c enabled (the manual way) and I did see it enabled at 400 KHz. It was visible under 1 Display Options. Not an obvious place.I selected it to toggle on/off but dietpi-config throws an error:
"/DietPi/dietpi/dietpi-config: line 226: / 1000 : syntax error: operand expected (error token is "/ 1000 “)”
I cannot start dietpi-config anymore; it keeps throwingthis error. After cleaning up config.txt, I can start dietpi-config again but choosing 1 Display options gives me the error again.
I tried a few things to resolve the issue but to no avail.
Egbert jan
Hi Dan. No time found to do a reinstall. Thanks for the correction of the syntax in config.txt.
Wrt GPU: I do not want GPU… I want to be able to choose for just a console on serial (ttyAMA0) and runlevel 3. When I find a decently priced small HDMI screen, I might go for console on HDMI and maybe go to runlevel 5.
EJ
OK. After a reinstall (still v94) and automatic update to v99 all seems ok. No output to ttyAMA0. I had to login via ssh. Should be easy to get ttyAMA0 spit out the same output as ttyX on HDMI. The i2c bus is satisfied; i2cdetect gives the expected output. Selecting a few packages brings in a lot of other packages. All dependencies I think. I think I saw a lot of X. Don’t want that… As said I would like to have a headless device with console output and without X.
Still good to see al works as advertized. TNX, Egbert Jan
Can you post the links for the i2c device you have, and, the serial line connector? I really need to get this hardware so I can test and provide a better implementation.
Sorry for not replying earlier. The BBnotifier seems not to work. I use many 12c devices. It is is just a handy bus. Nearly all the time I use at least a 2x16 or 4x20 LCD display. The interface hardware is a PCF8574. For the console I use a USB <-> serial cable bought from DX.COM. Any USB-Serial cable will do, I guess. The cable I use has 4 wires: in/out, gnd and 5V. Since I feed the RPi via the mini-USB port, I leave the +5 from the USB cable unconnected. The active part is in the USB end of the cable and is powered by the PC/laptop. On the PC i use PuTTY as terminal program.
Best regards, Egbert Jan