Go to advanced search

by TonySterrett
Wed Sep 18, 2019 12:55 pm
Forum: Bare metal, Assembly language
Topic: mmap() fails
Replies: 9
Views: 2437

Re: mmap() fails

Akane wrote:
Wed Sep 18, 2019 12:33 am
offset should be 0xFE000000?
Yes this is the base address for the Pi 4
by TonySterrett
Wed Sep 18, 2019 12:54 pm
Forum: Bare metal, Assembly language
Topic: mmap() fails
Replies: 9
Views: 2437

Re: mmap() fails

The problem occurred before that code the file did not open it told you Unable to open /dev/mem The illegal argument is the file handle. Ok I see what you are saying but /dev/mem is successfully opened by a preceding open() statement as so: memfd = fd; if (fd < 0) { printf("mapmem: file descriptor ...
by TonySterrett
Tue Sep 17, 2019 5:55 pm
Forum: Bare metal, Assembly language
Topic: mmap() fails
Replies: 9
Views: 2437

Re: mmap() fails

joan wrote:
Tue Sep 17, 2019 5:34 pm
Not withstanding that bare metal people tend to know more than the rest of us but mmap is UNIX derived and not really bare metal.
I understand and I did review the articles here before posting, it seemed ok. My bad.
by TonySterrett
Tue Sep 17, 2019 5:21 pm
Forum: Bare metal, Assembly language
Topic: mmap() fails
Replies: 9
Views: 2437

mmap() fails

Hello, I am trying to access /dev/mem using a nodejs module. I am aware this takes root access. I have asked this question elsewhere but I am refocusing the question on this forum, as The nodejs module uses a C program which is its interface to the hardware. The low level C program can be compile an...
by TonySterrett
Thu Sep 12, 2019 4:31 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

So to sum it up, mmap() is failing when called from node js rpio. But not when the C code is complied and run on its own. The error says Invalid argument but all parameters are check (and displayed in latest debug). I am playing with the parameters however. I suspect a the file descriptor was/is bad...
by TonySterrett
Thu Sep 12, 2019 4:11 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

joan wrote:
Mon Sep 09, 2019 9:11 pm
Have you clicked on the link? The linked code DOES use /dev/mem.
yes
by TonySterrett
Tue Sep 10, 2019 12:29 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

joan wrote:
Mon Sep 09, 2019 9:11 pm
Have you clicked on the link? The linked code DOES use /dev/mem.
Oh the description is wrong then. These programs to not provide hardware access layer for Nodejs, as is my problem. None of them even mention providing such a binding to nodejs
by TonySterrett
Mon Sep 09, 2019 9:03 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

The code I linked uses /dev/mem and works on all Pis. My C code does not fail either. The problem is when The C code is called from a Javascript (nodejs) program mmap() fails. Which is very odd because C doesn't know how its called. The only difference in the calls that I can see are that the file ...
by TonySterrett
Mon Sep 09, 2019 8:15 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

For what it is worth have a look at http://abyz.me.uk/rpi/pigpio/examples.html#Misc_minimal_gpio Thanks. The particular difficulty I am having requires access to the /dev/mem device. /dev/gpio won't do. the /dev/mem device requires root access btw. My main difficulty seems to be calling mmap() corr...
by TonySterrett
Mon Sep 09, 2019 6:31 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

The size of hex 1800000 seems suspicious. I tend to just map individual peripherals and the few bytes they need. I meant does the code work on the Pi3 with the correct offset. Understood, regard the your approach to map what you need. I am in the process of upgrading some code to the Pi 4 for the P...
by TonySterrett
Mon Sep 09, 2019 5:21 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

The size of hex 1800000 seems suspicious. I tend to just map individual peripherals and the few bytes they need. I meant does the code work on the Pi3 with the correct offset. Yes it does work with the correct offset. Please note, This also work when opening /dev/gpiomem. It is the mmap() function ...
by TonySterrett
Mon Sep 09, 2019 3:42 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Re: Problems with Pi 4 Wiring Pi4 GPIO

joan wrote:
Mon Sep 09, 2019 3:21 pm
You don't say if the code runs on the Pi3.


Could you print the errno value as well as the string?
No it does not. BCM2835_PERI_BASE has beed changed to 0xFE000000. Which is incorrect for the Pi3.
The Errno value is 22.
by TonySterrett
Mon Sep 09, 2019 3:00 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 13
Views: 631

Problems with Pi 4 Wiring Pi4 GPIO

I am writing code to access /dev/mem on the raspberry pi 4. I'm using nodejs with the package rpio. Rpio uses a "C" language interface. I have modified the *.h file to reflect changes in the hardware address for pi3 to pi4. like so: #define BCM2711_RPI4_PERI_BASE 0xFE000000 I am aware that root perm...
by TonySterrett
Wed Aug 28, 2019 3:07 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Re: Problems with Pi 4 Wiring Pi4 GPIO

joan wrote:
Tue Aug 27, 2019 9:07 pm
In that case there is either a wiring problem or 18 is not referring to the GPIO you think it is.

https://pinout.xyz/
Thanks
by TonySterrett
Wed Aug 28, 2019 2:57 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Re: Problems with Pi 4 Wiring Pi4 GPIO

Thanks people. I Think I have solved the problem :D . The Key was the gpio readall which mapped WiringPI pin number to GPIO pin numbers. I am still having problems associating the GPIO pin number to the actual address of the pin register.
by TonySterrett
Wed Aug 28, 2019 2:54 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Re: Problems with Pi 4 Wiring Pi4 GPIO

Not in any way an answer to your question, but before you expend a lot of effort to get it running are you aware that the sole developer/maintainer of WiringPi has recently announced that he is no longer developing or supporting it and has recommended seeking an alternative: I will make a final rel...
by TonySterrett
Tue Aug 27, 2019 9:05 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Re: Problems with Pi 4 Wiring Pi4 GPIO

Just to confirm that you're using an up to date version of wiringPi what does gpio -v and gpio readall report? (Compare with that here: http://www.cpmspectrepi.uk/raspberry_pi/MoinMoinExport/WiringPiGpioReadall.html#Pi_4_B) Trev. pi@raspberrypi:~ $ gpio -v gpio version: 2.52 Copyright (c) 2012-2018...
by TonySterrett
Tue Aug 27, 2019 8:59 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Re: Problems with Pi 4 Wiring Pi4 GPIO

joan wrote:
Tue Aug 27, 2019 8:44 pm
Have you downloaded the latest version?



Yes I am up to date.

http://wiringpi.com/wiringpi-updated-to ... rry-pi-4b/
by TonySterrett
Tue Aug 27, 2019 8:36 pm
Forum: Troubleshooting
Topic: Problems with Pi 4 Wiring Pi4 GPIO
Replies: 14
Views: 3145

Problems with Pi 4 Wiring Pi4 GPIO

Hello: I am trying to toggle a LED mapped to GPIO. My code does not working and I have been working on a reason why. I'm thinking this may have something to do with the GPIO base address being changed on the Pi 4. Here is my (non-working) code: #include <wiringPi.h> int main (void) { wiringPiSetup (...
by TonySterrett
Thu Apr 04, 2019 8:31 pm
Forum: Ubuntu
Topic: Error reducing rootfs partition size (ubuntu)
Replies: 0
Views: 2415

Error reducing rootfs partition size (ubuntu)

Hello: I am using Ubuntu Linux. I am trying to resize the partition /dev/sdb2 labled rootfs. Currently the partition size is 7.36 and the used size is 4.84GB. I am trying to reduce the size of Raspbian named the second partition labelled rootfs. I have tried to resize using gparted, which fails gpar...

Go to advanced search