Go to advanced search

by pygmalion
Wed Dec 02, 2020 2:07 pm
Forum: C/C++
Topic: PWM from C
Replies: 13
Views: 629

Re: PWM from C

Thanks for the suggestion.

I have implemented it in my program which will be shared on the github soon.
by pygmalion
Sun Nov 29, 2020 3:58 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

If you want to get down to a handful of nanoseconds you can read the system timer as I described in this thread here: https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=268692#p1631074 Yes, I already tested this code. But it gave the results in microseconds (numbers around 1000000). Is it poss...
by pygmalion
Sun Nov 29, 2020 1:52 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

The code on the webpage is only for explanation. Of course I figured out how to do it fast and all at once in C. If you don't volunteer relevant info you don't get the most useful answers. Good, you set/clr multiple pins at once, but you build the masks on the fly and you use multiple instructions ...
by pygmalion
Sun Nov 29, 2020 1:38 pm
Forum: C/C++
Topic: PWM from C
Replies: 13
Views: 629

Re: PWM from C

I figured out everything but two things.

Why is there option for /pwmchip1? All the examples on Internet have /pwmchip0 and both channels PWM0 and PWM1, as well as all four GPIOs 12, 13, 18, 19 are connected to /pwmchip0.

Also, func=2 and func=4 in overlay correspond to ALT0 and ALT5, right?
by pygmalion
Sat Nov 28, 2020 10:02 pm
Forum: C/C++
Topic: PWM from C
Replies: 13
Views: 629

Re: PWM from C

For anyone interested, I have found this interesting resource https://jumpnowtek.com/rpi/Using-the-Raspberry-Pi-Hardware-PWM-timers.html with a Python example. I have tested it and it seems to work only if overlay command is put into config.txt. It seems that this automatically puts GPIO18/19 into A...
by pygmalion
Sat Nov 28, 2020 7:52 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Quite contrary. 14ns is not visible, but I want to make it even smaller, with my limited knowledge. I know how to do it with improved timings, but I don't know how to do it with other proposed methods. If you knew how to do that you wouldn't be here asking, would you? So here are opportunities to e...
by pygmalion
Sat Nov 28, 2020 6:12 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

You want to go faster, but it's not clear you need to, or that the display would benefit (or even work since when you tried, it failed) You haven't given any idication you know how fast this screen can go or where your time critical code is. I cannot provide an answer that I don't know. For example...
by pygmalion
Sat Nov 28, 2020 5:26 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Well thank you to show the interest, but you might be disappointed - it is all about a probably amateurish project of mine. I was always very interested in chip communications. After I wrote a library for MCP4728 (which requires non-standard I2C communication), I switched to communications with LCD ...
by pygmalion
Sat Nov 28, 2020 3:28 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Also, I have invested so much time into my C script for parallel communication and I just want to finish the project. (Additional plus is that the choice of GPIOs is arbitrary.) Naturally you are attached to your work to date. Do you have it working but not fast enough? When you realise that drivin...
by pygmalion
Sat Nov 28, 2020 2:01 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

If you're doing a parallel bus then use the SMI peripheral. You can adjust the setup/hold/strobe timings. Only 6 address lines but you get 18 data lines. SMI peripheral lacks publicly-available documentation. For a start I have no idea how to force it to do different protocols (8080 or 6800), requi...
by pygmalion
Fri Nov 27, 2020 5:38 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Thanks for your suggestions. I was aware of some of the alternatives. However I intended to write a general purpose two way parallel communication library for RPi and share it on github (with timings as parameters). Maybe this is stupid, but it is my pet project, if you don't mind. The timing probl...
by pygmalion
Fri Nov 27, 2020 5:05 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Of course, I can manipulate timings by putting bogus commands, but this will be valid only on RPi3. On RPi4 it will be too fast, on Pi Zero too slow. The only proper way is to read clock. You can't get finer control than single instruction time. Obviously you can't use multiple instructions to read...
by pygmalion
Fri Nov 27, 2020 4:36 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

I never said I need nanosecond accuracy. But I do need sub-microsecond accuracy. If I go as fast as possible, communication fails. I do need time measurements in order of at least hundred to few hundred nanoseconds. Why do you think you need sub-microsecond accuracy? If fast as possible fails maybe...
by pygmalion
Fri Nov 27, 2020 4:15 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Of course I can communicate as slow as I like, but I want to communicate as fast as possible! Say you have screen with few ten thousand pixels and you want to transfer picture fast enough so you don't see the transfer by a bare eye? You have to be real fast. So go as fast as you can. You certainly ...
by pygmalion
Fri Nov 27, 2020 4:14 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Didn't it occur to you to mention that you wanted to interface a graphic LCD display using this controller chip? No mention of any of this in the OP. So, you don't need to measure time with nanosecond accuracy" at all, do you? Reading the datasheet you linked to there are no tight tolerances on the...
by pygmalion
Fri Nov 27, 2020 3:49 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

As an example see Figure 8.1 and Table 8.3 on page 40 of this document: https://www.newhavendisplay.com/app_notes/RA6963.pdf Didn't it occur to you to mention that you wanted to interface a graphic LCD display using this controller chip? No mention of any of this in the OP. So, you don't need to me...
by pygmalion
Fri Nov 27, 2020 3:13 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

When you do parallel communications, there are some timings you have to respect. For example, there should be some minimum time between setting bits and issuing clock line. There is certain time clock line must be 0 (8080 communication) or 1 (6800 communication). All this timings are in tens or hun...
by pygmalion
Fri Nov 27, 2020 2:48 pm
Forum: C/C++
Topic: PWM from C
Replies: 13
Views: 629

Re: PWM from C

The option to enable the pwm device in config.txt states which GPIO you will be using. Mine is set for GPIO 18 (pin 12) dtoverlay=pwm,pin=18,func=2 In C, I open the pwmchip0 files for writing, then write the required values and close the file. Python could be done the same way, or use a shell comma...
by pygmalion
Fri Nov 27, 2020 2:43 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

I don't quite understand what are you aiming at. Perhaps that need for nanosecond timing suggests that the chip I am communicating to is not fast enough? Yes, that is true. It is slow enough that additional timing is necessary when running from C, and fast enough that no additional timing is necess...
by pygmalion
Fri Nov 27, 2020 2:42 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

I don't quite understand what are you aiming at. Perhaps that need for nanosecond timing suggests that the chip I am communicating to is not fast enough? Yes, that is true. It is slow enough that additional timing is necessary when running from C, and fast enough that no additional timing is necess...
by pygmalion
Fri Nov 27, 2020 1:51 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

Since the present Raspberry Pi brain trust could not come with a viable solution, I guess precision sub-microsecond timing with RPi is next to impossible to do. You need hardware to measure such tiny intervals, but you could use RPi to do something with the data from such a device. LIDAR is one exa...
by pygmalion
Thu Nov 26, 2020 8:17 pm
Forum: C/C++
Topic: PWM from C
Replies: 13
Views: 629

Re: PWM from C

Thanks for the answers. /sys/class/pwm/pwmchipX/ works on both GPIO12/GPIO18 and GPIO13/GPIO19, right? How can I know which one in the pair will be activated? GPIO12/13 must be inALT0, GPIO18/19 in ALT5? Does this mean that I have to issue echo from C / Python program? (Sounds a bit strange?)
by pygmalion
Thu Nov 26, 2020 8:06 pm
Forum: C/C++
Topic: How to measure time with nanosecond accuracy?
Replies: 64
Views: 2583

Re: How to measure time with nanosecond accuracy?

I also stumbled on this problem as I am programming fast parallel communication and I also use code type proposed by jahboater . The code is however extremely slow. clock_gettime alone needs 250ns (!) and another 80ns for calculation on RPi3. That is huge compared to (re)setting pins, which accounts...
by pygmalion
Tue Nov 17, 2020 10:28 am
Forum: General discussion
Topic: Installing Pulseview
Replies: 5
Views: 152

Re: Installing Pulseview

fruitoftheloom wrote:
Tue Nov 17, 2020 9:55 am
Not much help but Debian Bullseye will be released in mid 2021 which has 4.2
Better than nothing.

In the meantime, version 5.0 is already available on Windows...
by pygmalion
Tue Nov 17, 2020 9:38 am
Forum: General discussion
Topic: Installing Pulseview
Replies: 5
Views: 152

Re: Installing Pulseview

After some search I realised that: - my version is 4.1, which is from 2018 (!) - only version 4.2 has session setup , which is extremely useful. I am not quite experienced in Linux, so I don't think I will be able to build 4.2 myself. Is there anyone I can turn to and suggest that the newest version...

Go to advanced search