jsimmonds2

jsimmonds2

Trying to get my very basic Nerves (on RPi3B+) solution talking to an I2C RTC, the Maxim DS3231,
apparently a very supported device for Raspbian 9 !

Followed the steps documented but still no /dev/rtc appears.
The Raspberry Pi doc suggests turning on dtdebug=on in config.txt and then using the VideoCore debug utility to read the resulting logs . . problem is that the nerves_system_rpi3 buildroot image doesn’t carry the /opt/vc/bin or /opt/vc/lib folders !

Tried pushing those bits into rootfs_overlay but then the vcdbg utility still can’t load the shared object /opt/vc/lib/libelftoolchain.so . .. and in fact none of the usual ld files seem to be around (/etc/ld.so.cache, /etc/ld.so.conf, etc.)

Showing Posts 1 to 10

ConnorRigby

ConnorRigby

Nerves Core Team

I don’t actually think you should need an overlay to enable the DS3231.

in make linux-menuconfig
check device driversreal time clock supportDallas/Maxim DS1307/37/38/39/40/41, ST M41T00, EPSON RX-8025, ISL12057

You can set that to * and you should have rtc0 after booting.

jsimmonds2

jsimmonds2 OP

Ok, two quick things about that . .

  1. those menu options don’t actually list the Maxim/Dallas DS3231 chip
  2. the i2c-rtc DTB doco includes the DS3231 which should then provide the /dev/rtc char special link

Thanks anyways :neutral_face:

How do I go about adding that VC optional package to my basic Nerves project ?

jsimmonds2

jsimmonds2 OP

Inching toward enlightenment . . :wink:

Worked out how to run /opt/vc/bin/vcdbg and, sure enough, the DT load debugging is there ! (Almost) :frowning:

How do I get the complete output of :os.cmd (below) ?

iex(fb2@fb2-5116)99> :os.cmd 'export LD_LIBRARY_PATH=/opt/vc/lib ; /opt/vc/bin/vcdbg log msg'

'001322.945: brfs: File read: /mfs/sd/config.txt\n001323.887: brfs: File read: 1479 bytes\n001333.499: HDMI:EDID error reading EDID block 0 attempt 0\n001334.804: HDMI:EDID error reading EDID block 0 attempt 1\n001336.101: HDMI:EDID error reading EDID block 0 attempt 2\n001337.399: HDMI:EDID error reading EDID block 0 attempt 3\n001338.694: HDMI:EDID error reading EDID block 0 attempt 4\n001339.992: HDMI:EDID error reading EDID block 0 attempt 5\n001341.287: HDMI:EDID error reading EDID block 0 attempt 6\n001342.586: HDMI:EDID error reading EDID block 0 attempt 7\n001343.882: HDMI:EDID error reading EDID block 0 attempt 8\n001345.180: HDMI:EDID error reading EDID block 0 attempt 9\n001346.239: HDMI:EDID giving up on reading EDID block 0\n001363.125: brfs: File read: /mfs/sd/config.txt\n001363.948: HDMI:Setting property pixel encoding to Default\n001364.006: HDMI:Setting property pixel clock type to PAL\n001364.068: HDMI:Setting property content type flag to No data\n001364.125: HDMI:Setting property fuzzy format match to enabled\n001584.974: gpioman: gpioman_get_pin_num: pin DISPLAY_DSI_PORT not defined\n001586.303: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead\n001586.378: hdmi: HDMI:>>>>>>>>>>>>>Rx sensed, reading EDID<<<<<<<<<<<<<\n001586.721: hdmi: HDMI:EDID error reading EDID block 0 attempt 0\n001588.028: hdmi: HDMI:EDID error reading EDID block 0 attempt 1\n001589.330: hdmi: HDMI:EDID error reading EDID block 0 attempt 2\n001590.632: hdmi: HDMI:EDID error reading EDID block 0 attempt 3\n001591.933: hdmi: HDMI:EDID error reading EDID block 0 attempt 4\n001593.235: hdmi: HDMI:EDID error reading EDID block 0 attempt 5\n001594.537: hdmi: HDMI:EDID error reading EDID block 0 attempt 6\n001595.839: hdmi: HDMI:EDID error reading EDID block 0 attempt 7\n001597.140: hdmi: HDMI:EDID error reading EDID block 0 attempt 8\n001598.442: hdmi: HDMI:EDID error reading EDID block 0 attempt 9\n001599.507: hdmi: HDMI:EDID giving up on reading EDID block 0\n001599.575: hdmi: HDMI: No lookup table for resolution group 0\n001599.637: hdmi: HDMI: hotplug attached with DVI support\n001599.709: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead\n001600.042: hdmi: HDMI:EDID error reading EDID block 0 attempt 0\n001601.348: hdmi: HDMI:EDID error reading EDID block 0 attempt 1\n001602.653: hdmi: HDMI:EDID error reading EDID block 0 attempt 2\n001603.959: hdmi: HDMI:EDID error reading EDID block 0 attempt 3\n001605.264: hdmi: HDMI:EDID error reading EDID block 0 attempt 4\n001606.569: hdmi: HDMI:EDID error reading EDID block 0 attempt 5\n001607.875: hdmi: HDMI:EDID error reading EDID block 0 attempt 6\n001609.180: hdmi: HDMI:EDID error reading EDID block 0 attempt 7\n001610.485: hdmi: HDMI:EDID error reading EDID block 0 attempt 8\n001611.790: hdmi: HDMI:EDID error reading EDID block 0 attempt 9\n001612.858: hdmi: HDMI:EDID giving up on reading EDID block 0\n001612.933: hdmi: HDMI: hotplug deassert\n001612.986: hdmi: HDMI: HDMI is currently off\n001613.037: hdmi: HDMI: changing mode to unplugged\n001613.101: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead\n001614.473: *** Restart logging\n001614.536: brfs: File read: 1479 bytes\n001618.178: brfs: File read: /mfs/sd/cmdline.txt\n001618.346: Read command line from file \'cmdline.txt\':\n001618.402: \'console=tty1 console=serial0,115200 fbcon=scrollback:1024k root=/dev/mmcblk0p2 rootwait consoleblank=0\'\n001618.699: brfs: File read: 341 bytes\n001773.870: brfs: File read: /mfs/sd/zImage\n001773.932: Loading \'zImage\' to 0x8000 size 0x264178\n001778.328: No kernel trailer - assuming DT-capable\n001778.415: brfs: File read: 2507128 bytes\n001781.363: brfs: File read: /mfs/sd/bcm2710-rpi-3-b-plus.dtb\n001781.426: Loading \'bcm2710-rpi-3-b-plus.dtb\' to 0x26c178 size 0x63e6\n001928.628: brfs: File read: 25574 bytes\n001933.099: brfs: File read: /mfs/sd/config.txt\n001933.479: dtparam: i2c_arm=on\n001950.237: dtparam: spi=on\n001964.748: dtparam: audio=on\n001984.044: brfs: File read: 1479 bytes\n001988.189: brfs: File read: /mfs/sd/overlays/rpi-ft5406.dtbo\n002000.911: Loaded overlay \'rpi-ft54' ++ ...
iex(fb2@fb2-5116)100>

NobbZ

NobbZ

Roughly and antested:

~c"export LD_LIBRARY_PATH=/opt/vc/lib;\n/opt/vc/bin/vcdbg log msg"
|> :os.cmd()
|> IO.puts
fhunleth

fhunleth

Co-author of Nerves

If you end up doing this frequently, take a look at toolshed. It has a number of IEx helper functions. One of them is cmd/1. It deals with Erlang vs. Elixir strings when calling :os.cmd() and also prints stdout as it’s generated rather than waiting until the program exits.

iex> use Toolshed
iex> cmd("LD_LIBRARY_PATH=/opt/vc/lib /opt/vc/bin/vcdbg log msg")

p.s. I didn’t realize that vcdbg could help debug DT issues. That’s really helpful!

p.p.s. I have the feeling that you downloaded a vcdbg binary that was built with the opposite hard float/soft float ABI setting that we use on Nerves and it caused frustration. I don’t think you should change what you’re doing now since you got it to work. However in the future, you can also add vcdbg to nerves_system_rpi3 by setting BR2_PACKAGE_RPI_FIRMWARE_INSTALL_VCDBG=y in the nerves_defconfig. This can also be found via make menuconfig, but it’s kind of buried.

jsimmonds2

jsimmonds2 OP

Elegant, useful and now tested :+1: Thanks.

jsimmonds2

jsimmonds2 OP

Thanks alot for those details; very helpful for me !

Will investigate the hard/soft float setting on that vcdbg executeable . . though I just copied the exe and two .so from a vanilla RPi3B+ host running Raspbian latest, with kenel 4.14.79+.

I’ll keep on exploring this one until I get that RTC running !
Maybe I first need to health-check the device with some manual probing using an ElixirALE.I2C port . . :neutral_face:
It does respond, as expected, at 0x68.

jsimmonds2

jsimmonds2 OP

Both Time and the “water under the bridge” have flowed . .

Next thing I (was) going to try today was to get my bespoke nerves_system_rpi3 working so that I could use linux-menuconfig to add a driver for the ds1307 RTC ( in the vain hope of getting the i2c-rtc.dtbo doing something (anything at all) with my (healthy) Maxim DS3231 RTC I2C device but . . tried this . . now what !? (looks like I still need that linux-menuconfig to get the /dev/rtc to materialize)

iex(fb2@fb2-5116)1> ~c' echo ds3231 0x69 > /sys/class/i2c-adapter/i2c-1/new_device '|>:os.cmd()|>IO.puts

11:33:23.801 [info] [ 32.630303] i2c i2c-1: new_device: Instantiated device ds3231 at 0x69

jsimmonds2

jsimmonds2 OP

Indeed ! As soon as I mustered the courage and followed the clear instructions on building a custom rpi3 system the interfaces appeared in /dev/rtc0 , /sys/class/rtc , etc.

Thanks to you, @ConnorRigby

Only thing left for me to understand is how DT Overlays work and whether I still need to add one to get the DS3231-specific differences . . (?) , e.g.

iex(fb2@fb2-5116)1> ~c' cat /sys/devices/platform/soc/3f804000.i2c/i2c-1/1-0068/name '|>:os.cmd()|>IO.puts
ds3231

:ok

ConnorRigby

ConnorRigby

Nerves Core Team

Its essentially black magic… Just kidding, they are a little weird though. The kernel docs have a good gist of it: https://www.kernel.org/doc/Documentation/devicetree/overlay-notes.txt

You shouldn’t need to touch any device tree overlays to get any of the DS based real time clocks to work. They work via i2c so as long as you linux device has i2c enabled, you should be good to go.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews