Go to advanced search

by JGPIO
Sun Nov 17, 2019 11:01 pm
Forum: C/C++
Topic: Rapberry pi 4 IO memory base address
Replies: 20
Views: 7800

Re: Rapberry pi 4 IO memory base address

Perhaps I've missed something, but is there any particular reason no one is using the bcm_host_get_peripheral_address() function?
by JGPIO
Tue Sep 06, 2016 7:26 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

Sorry it's been so long.

My Java code on my B+ will run a set/clr loop at 11MHz+, and when overclocked to Medium it will run at 15MHz+. My PI3 runs the same code at 50MHz+

I need to obtain independent verification of this.
by JGPIO
Thu Aug 25, 2016 2:50 pm
Forum: C/C++
Topic: RPi3 macros
Replies: 6
Views: 1530

Re: RPi3 macros

Thank you all for your help.

I haven't used gcc since my SCO Unix days in the second half of the 1990's.

Much re-learning to do!
by JGPIO
Thu Aug 25, 2016 12:33 pm
Forum: C/C++
Topic: RPi3 macros
Replies: 6
Views: 1530

Re: RPi3 macros

jahboater wrote:If you give the correct options for the Pi3 CPU (which are: -mcpu=cortex-a53 -mfpu=neon-fp-armv8 ) you will have __ARM_ARCH_8A__ defined, even with the old compiler.
Nice! I just tried it. Thank you very much for that.
by JGPIO
Thu Aug 25, 2016 11:10 am
Forum: C/C++
Topic: RPi3 macros
Replies: 6
Views: 1530

Re: RPi3 macros

Well yes, I was actually expecting __ARM_ARCH_8__ to be defined.
by JGPIO
Thu Aug 25, 2016 10:54 am
Forum: C/C++
Topic: RPi3 macros
Replies: 6
Views: 1530

RPi3 macros

I've just received an RPi3 and I'm a little surprised that __ARM_ARCH_6__ is defined rather than __ARM_ARCH_7__

Have I misunderstood something or is this wrong?

Many thanks.
by JGPIO
Sat Jun 11, 2016 12:01 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

14Mhz+? Surely not?
by JGPIO
Sat Jun 11, 2016 8:02 am
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

Thanks!

I merely need to retrofit my existing work with the ByteBuffer solution. Should take less than an hour.

I'm guessing you would like a copy?
by JGPIO
Fri Jun 10, 2016 11:07 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

I was wrong!

Initial speed tests show my B+ performs a set/clr loop using a Java ByteBuffer at just short of 5Mhz!
by JGPIO
Fri Jun 10, 2016 10:57 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

Solved it! Having created a test-bed in isolation, and making it so that I could configure every relevant parameter to mmap and NewDirectByteBuffer, I determined that a 0 offset to mmap does not have any effect on this problem at all. I resorted to studying the code of the DirectByteBuffer class but...
by JGPIO
Wed Jun 01, 2016 8:01 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

The address passed to the NewDirectByteBuffer doesn't have to be the start of the mapped memory - you can add the offset and pass that in, but it's not working right for me at the moment.

Other questions arise.

I can't yet find any documentation explaining why a zero offset to mmap works.
by JGPIO
Wed Jun 01, 2016 5:42 pm
Forum: Java
Topic: Java access to /dev/gpiomem via JNI NewDirectByteBuffer
Replies: 16
Views: 4320

Re: Java access to /dev/gpiomem via JNI NewDirectByteBuffer

Well done. Passing 0 to the offset parameter to mmap, allows Java to provide the full correct register value.

Many, many thanks to you.
by JGPIO
Wed Jun 01, 2016 5:31 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

I spent ages looking at those 3 hex numbers, the nibbles, the binary pattern, etc etc, but at no point did I think ASCII.

I bet you spotted that in seconds to!
by JGPIO
Tue May 31, 2016 9:25 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

Yeah, I'm now setting the byte order to the native byte order which has helped a lot:

buf.order(ByteOrder.nativeOrder());
by JGPIO
Tue May 31, 2016 8:56 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

Have you noticed that the last (least significant) byte displayed by the C code is the same as is displayed by the Java code?

Java is hell-bent on making the other 3 bytes 0x677069, ie Java reports each register as 0x677069nn where nn is the correct value.

Don't know why.......yet!
by JGPIO
Mon May 30, 2016 10:47 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

Outputting a group of registers (from within the c code) immediately before and immediately after calling NewDirectByteBuffer, displays the same results as one would expect. Calling GetDirectBufferAddress (passing the buffer returned by NewDirectByteBuffer) immediately after the call to NewDirectByt...
by JGPIO
Mon May 30, 2016 6:42 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

Our code is almost identical. I access /dev/mem. Remember that some BCM2835 GPIO registers are read only or are reserved, thus a read from these are undefined. However, reading readable GPIO registers that do not change much, should return the same value from the c code and the Java code. My results...
by JGPIO
Mon May 30, 2016 2:36 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

My existing Java/C (via JNI) code is specialised to the BCM2835 soc and I'm using a B+ o/c to Medium. It works brilliantly and with all 54 GPIO pins, and runs fast. I recently turned to Java NIO to either make the code 100% Java or see if runs even faster (by eliminating some or all the JNI overhead...
by JGPIO
Mon May 30, 2016 11:47 am
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

My own Java classes backed by my own JNI interface can manage 3MHz in a pin set/clr loop. I'm trying to test memory mapped i/o in Java to determine if this is faster. The 100% Java /sys/class/gpio/gpioNN approach listed above works but is much slower (drops to KHz). The 100% Java NIO approach does n...
by JGPIO
Sun May 29, 2016 9:00 pm
Forum: Java
Topic: Java GPIO Frequency Benchmarks
Replies: 35
Views: 21242

Re: Java GPIO Frequency Benchmarks

You might want to refer to your loop variable 'i' in your c code:

gpioAddr rather than gpioAddr[0]

then let us know what happens.
by JGPIO
Sun Feb 28, 2016 8:58 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO
Replies: 11
Views: 1873

Re: GPIO

I've just been reading the link provided by 6by9 and the following line puzzled me:

pin@p35 { function = "input"; termination = "no_pulling"; polarity = "active_low"; }; // Power low

input? Power Low?

Then I read the post by rpdom which made the line make sense.

Many thanks to you all.
by JGPIO
Sun Feb 28, 2016 8:35 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO
Replies: 11
Views: 1873

Re: GPIO

Wow rpdom, you're right! I've just made the Power and Activity LEDs on my B+ blink. Many thanks!

One would have assumed the Power LED was connected direct to the supply, not under control of the BCM2835.

How did you know this. What other pin usage are you aware of?
by JGPIO
Sun Feb 28, 2016 8:10 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO
Replies: 11
Views: 1873

Re: GPIO

Many thanks for all the replies. I am aware of the defaults and alternative functions of all 54 BCM2835 GPIO pins, and I know which pins are availabe on the GPIO header(s) for the various versions of the RPi. What I don't know for certain is what the RPi uses the other pins for. According to http://...
by JGPIO
Sun Feb 28, 2016 7:01 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO
Replies: 11
Views: 1873

Re: GPIO

Yeah, and I understand some are used for sound, some for the camera module, some for status LEDs etc etc, but I can't find anything official.

Thanks for the fast response though!
by JGPIO
Sun Feb 28, 2016 6:33 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: GPIO
Replies: 11
Views: 1873

GPIO

Hello.

The BCM2835 soc has 54 GPIO pins, but only some of these are available on the GPIO connector.

Is there any documentation showing what the other pins are used for?

Many thanks.

Go to advanced search