Search found 23 matches
- Sat Nov 21, 2020 2:51 pm
- Forum: General programming discussion
- Topic: Programming on RPI 4 vs. RPI 3
- Replies: 2
- Views: 425
Re: Programming on RPI 4 vs. RPI 3
The base peripheral address has changed for the BCM2711 (Pi 4B and friends), the mechanism for setting pull-up and pull-down resistors is very different, and there are more on-chip peripherals, so you will have to make some changes to your library. Those changes aren't that onerous when just dealin...
- Fri Nov 20, 2020 3:01 pm
- Forum: General programming discussion
- Topic: Programming on RPI 4 vs. RPI 3
- Replies: 2
- Views: 425
Programming on RPI 4 vs. RPI 3
Hi!
I created a library to access some GPIO functions and I did it using my Raspberry PI 3B. Everything works perfectly. If I buy the new Raspberry PI 4, will I have to modify my library? I did all the programming based on registers and values from the BCM2837 / BCM2835 datasheet
I created a library to access some GPIO functions and I did it using my Raspberry PI 3B. Everything works perfectly. If I buy the new Raspberry PI 4, will I have to modify my library? I did all the programming based on registers and values from the BCM2837 / BCM2835 datasheet
- Thu Oct 03, 2019 8:22 pm
- Forum: General programming discussion
- Topic: The clock divisor formula on datasheet is wrong?
- Replies: 2
- Views: 2045
Re: The clock divisor formula on datasheet is wrong?
Thank you!DougieLawson wrote: ↑Thu Oct 03, 2019 6:04 pmReport it here: https://github.com/gadgetoid/Pinout.xyz/issues and the Pinout folks will help you.
- Thu Oct 03, 2019 2:12 am
- Forum: General programming discussion
- Topic: The clock divisor formula on datasheet is wrong?
- Replies: 2
- Views: 2045
The clock divisor formula on datasheet is wrong?
The site https://pinout.xyz/pinout/gpclk states that there are an error at DataSheet page 105 and that the correct divisor is 4096 and not 1024. The site do not show any source for this information and I would like to know if this is true. If so, please, show me some source
- Thu Aug 01, 2019 3:48 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
I got reproduce the code in Pascal. And, really, using the "magic SECRET_PEEK_ constants" as offsets from GPIO base address I can read the names of some peripherals. Now I'm confuse... As all the secret constants are offsets from GPIO base address what can I do with them? Lets use the PWM0...
- Wed Jul 31, 2019 5:57 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Very interesting, for sure... I'll try to reproduce the code in Pascal. But I would like to konw how you discovered the values of "SECRET_PEEK_???" constants. I suppose that the datasheet do not have this information I could not find any online resources describing the methods enter() and ...
- Sat Jul 20, 2019 7:58 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
import GPIO def Hex(n): s = hex(n)[2:].upper() if len(s) < 8: s = ( "0" * (8-len(s)) ) + s return s def ByteToAscii(b): b = b & 0xFF if b == 0x00 : return "" elif b >= 0x20 and b < 0x7F : return chr(b) else : return "*" def LongToAscii(n): s = ByteToAscii(n >> 24 )...
- Sat Jul 20, 2019 12:08 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Hi Sir, I'm using some of your Ideas to make my own Pascal library.rudiratlos wrote: ↑Sun Jul 07, 2019 9:11 amif you want to review free pascal code, where it's implemented, pls. look at rpi_hal:
https://github.com/rudiratlos/rpi-hal
https://osdn.net/projects/pasripherals/
Feel free to comment

- Sat Jul 20, 2019 12:04 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Well, forgive my stupidity, but I cannot see how I can identify a register and make sure it is a particular register. The peripheral register area contains registers which are fixed constants and we start by identifying those. We start with code which knows what the peripheral base address is for t...
- Wed Jul 17, 2019 5:49 pm
- Forum: General discussion
- Topic: Two servo motors with different periods
- Replies: 9
- Views: 707
Re: Two servo motors with different periods
I think the minimum clock divider is 2, so that gives a maximum frequency of 250 MHz. However we are talking about PWM so there is no point having a signal which is always on or always off, we need at least one step, that makes the maximum possible PWM frequency 125 MHz. So at 125 MHz we call have ...
- Wed Jul 10, 2019 9:34 pm
- Forum: General discussion
- Topic: Two servo motors with different periods
- Replies: 9
- Views: 707
Re: Two servo motors with different periods
The use of the integer million rather than a float of say 100.0 is down to the exposed pigpio socket/pipe interface. http://abyz.me.uk/rpi/pigpio/sif.html in particular command 86 HP. All the parameters are integers. With hind sight I would now have made provision for floating point parameters. Usi...
- Wed Jul 10, 2019 7:16 pm
- Forum: General discussion
- Topic: Two servo motors with different periods
- Replies: 9
- Views: 707
Re: Two servo motors with different periods
Thanks for explain the frequencies. Have a look at wiringPi and the bcm2835 library as well - I think each uses a different software model to drive the PWM peripheral. Yes, I'm looking at all these libraries and, of course, the your. I'm trying to make the mine one very simple but Object Oriented, s...
- Wed Jul 10, 2019 5:54 pm
- Forum: General discussion
- Topic: Two servo motors with different periods
- Replies: 9
- Views: 707
Re: Two servo motors with different periods
There are such servos. Some servos operate up to 500 Hz. You can use the PWM peripheral to provide such signals. Hers is my pigpio doing 50 Hz 2000 µs on GPIO 12 and 75 Hz 1000 µs on GPIO 13. Code is gpioHardwarePWM in pigpio.c. Screenshot from 2019-07-09 17-58-37.png Hi Joan, I guess you commited ...
- Tue Jul 09, 2019 4:29 pm
- Forum: General discussion
- Topic: Two servo motors with different periods
- Replies: 9
- Views: 707
Two servo motors with different periods
Before start I must say that I do not know if this is possible, I mean, if there are servo motors with periods different from 20ms (50Hz). My question is at first glance hypothetical and I need to know the working from the side of RPI, because I'm implementing my own library, so, raw example codes (...
- Tue Jul 02, 2019 12:40 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
If all you want to know is the Linux address space peripheral base you can use the following. #include <stdio.h> #include <stdlib.h> #include <stdint.h> int main(int argc, char *argv[]) { FILE *fp; uint32_t base; unsigned char buf[12]; if (fp = fopen("/proc/device-tree/soc/ranges" , "...
- Tue Jul 02, 2019 12:37 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Your suggestion is very good. Do you have some example code? Once you have mmap'ed the GPIO area, you can step through each register reading 32-bits, considering those numbers as four 8-bit ASCII bytes, and seeing what turns up. gpio = mmap(...) while True: print Hex(gpio), ":", Hex( *gpi...
- Mon Jul 01, 2019 4:43 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
An arguably better way than having to determine what type of Pi the software is running on, having to know the base addresses in advance, is to perform mmap's with varying base addresses until the undocumented peripheral constant registers can be matched with what they should be . Hi hippy I guess ...
- Tue Jun 25, 2019 1:51 am
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
My apologies, As the code excerpt shows I thought that this was the default behavior. And there is also code for handling gpio in that manner. It is a case of looking at parts of something and not it's whole. In that light as you are saying it uses the /dev/mem and /dev/gpiomem then what is this co...
- Mon Jun 24, 2019 5:43 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
I believe also by default WiringPi doesn't use /dev/gpiomem it uses the Linux kernel interface and uses /sys/class/gpio/gpio## that might be why you don't see any conflicts. No! Take a look at WiringPi sources. It tries /dev/mem first and, if the user is not running as root, it uses /dev/gpiomem . ...
- Mon Jun 24, 2019 5:39 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Not really. mmap expects you to be using the /dev/mem device where offsets mean something. The /dev/gpiomem device (as written) ignores any offset and always grants access to the GPIO register area. Well, this really answer my question and I can consider this thread over. Thank you. However I would...
- Sat Jun 22, 2019 3:27 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Have a look at the BCM2835 library https://www.airspayce.com/mikem/bcm2835/ . That library uses /dev/gpiomem for gpio however you need to use /dev/mem for I2C unless you want to bitbang the protocol. Hi! I'm studying it also, very good indeed, because it uses only register offsets to achieve all th...
- Thu Jun 20, 2019 7:07 pm
- Forum: C/C++
- Topic: Memory mapping offets clarification
- Replies: 1
- Views: 919
Re: Memory mapping offets clarification
Hello! Do you have answers to these questions? I am now with the same doubts and it is strange to see that no one in this forum was able to answer your The datasheet seems to be a copy/paste from an old version and some memory addresses are wrong, for example, the base address of my RPI é 0x3F000000...
- Thu Jun 20, 2019 6:03 pm
- Forum: C/C++
- Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
- Replies: 27
- Views: 8892
What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Hi! I'm implementing a pascal library to deal with RPI3 peripherals. My goal is to control GPIO pins' functions, pins' logical levels, pins' pull resistors, I2C and PWM, at least. To achieve this I'm studying some well known C libraries, like WiringPi and examples available at http://abyz.me.uk/rpi/...