(v99) hardware centric config

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
egbert

(v99) hardware centric config

Post by egbert »

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
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: hardware centric config

Post by Fourdee »

egbert wrote: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.
Hi Egbert,

Thanks for the feedback, appreciate it.

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.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
egbert

Re: hardware centric config

Post by egbert »

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? ... ce_Scanner.

Egbert
egbert

Re: hardware centric config

Post by egbert »

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.

HtH, best regards,
Egbert Jan
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: hardware centric config

Post by Fourdee »

egbert wrote: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.

HtH, best regards,
Egbert Jan
Hi Egbert,

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.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: hardware centric config

Post by Fourdee »

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
egbert

Re: (v99) hardware centric config

Post by egbert »

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
egbert

Re: (v99) hardware centric config

Post by egbert »

Hmm, seems I had garbage in config.txt. Got it under control again.

Perhaps is mis understood the way dietpi.txt and config.txt play together. I'll do a fresh install to check. Maybe the FB messages also disappear...

[ 28.018385] raspberrypi-firmware soc:firmware: Request 0x00048003 returned status 0x80000001
[ 28.018408] bcm2708_fb soc:fb: Failed to allocate GPU framebuffer (-22)
[ 28.018417] bcm2708_fb_pan_display(0,0) returns=-22
[ 28.018515] raspberrypi-firmware soc:firmware: Request 0x0004800b returned status 0x80000001
[ 28.018531] bcm2708_fb soc:fb: Failed to set palette (-22,0)
[ 28.018624] raspberrypi-firmware soc:firmware: Request 0x0004800b returned status 0x80000001
[ 28.018639] bcm2708_fb soc:fb: Failed to set palette (-22,0)

Egbert Jan
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: (v99) hardware centric config

Post by Fourdee »

egbert wrote: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 Egbert,

Yep, could be due to your manual config.txt settings. We do patch existing config.txt, however, your manual entries may have thrown this off.
local rpi_i2cbaudrate_hz="$(( $(cat /DietPi/config.txt | grep 'i2c_arm_baudrate=' | sed 's/i2c_arm_baudrate=//g') / 1000 )) kHz"
This is causing the error. Make sure your config.txt has the following entry:

Code: Select all

i2c_arm_baudrate=400000
The GPU allocation issue, have you tried increasing the GPU memory split?
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
egbert

Re: (v99) hardware centric config

Post by egbert »

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
Post Reply