Go to advanced search

by jars121
Thu Jun 07, 2018 8:42 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fastest data acquisition methodology
Replies: 4
Views: 671

Re: Fastest data acquisition methodology

Thanks joan, much appreciated as always. As I usually do, I started with your library to try and better understand a non-spidev methodology and workflow. Interestingly, running the two scripts you've just provided shows only a minimal improvement between spidev and pigpio. 96 bytes (32 12-bit ADC in...
by jars121
Thu Jun 07, 2018 3:39 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fastest data acquisition methodology
Replies: 4
Views: 671

Re: Fastest data acquisition methodology

It would probably help if I added some code! Below is the code which calls the ADC read class: adcRead *adcReadPointer = adcRead::getInstance(); struct timeval startTv; struct timeval endTv; gettimeofday(&startTv, NULL); int x = 0; while (x < 10000) { int caller; caller = adcReadPointer->adcReturn()...
by jars121
Thu Jun 07, 2018 2:27 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fastest data acquisition methodology
Replies: 4
Views: 671

Re: Fastest data acquisition methodology

I've been testing all day, and I think I found the cause of my perceived slow SPI ADC conversion. My ADC setup function was being called three times, as the class constructor was being called three times. I've now fixed that, and the speeds appear more reasonable. I'm hoping to receive some feedback...
by jars121
Wed Jun 06, 2018 10:57 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Fastest data acquisition methodology
Replies: 4
Views: 671

Fastest data acquisition methodology

Evening all, Following on from this post, in which I learnt a considerable amount, I'm looking to understand the options available to me for high-speed data acquisition. I'm currently prototyping with a RPi2, but will be moving to a more commercial embedded Linux platform in the near future, so I'm ...
by jars121
Wed May 23, 2018 8:57 pm
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

It was most certainly of help, thank you for your thorough explanation.

My understanding is as follows:
  • SPI CLK will settle either HIGH or LOW if SPI data transmission pauses.
  • I'm going to need to put these registers on the second SPI bus as they don't have a CS function.
by jars121
Wed May 23, 2018 6:31 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

Thanks Heater. That approach aligns with my initial thinking. With that said, isn't the SPI CLK line still rising and falling, independent of what my code is doing? I.e. my code might be 'paused', and not producing any output to the device, but the attached CLK line is still toggling between LOW and...
by jars121
Tue May 22, 2018 11:13 pm
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

I've now got the rainbow effect working on spidev0.1, without addressing the 8 * period SCKI pause as specified in the datasheet. How is that? The LEDs still have an occasional, very slight flicker, but at this point I'm inclined to believe it's due to the wiring itself. My DATA and CLK lines for th...
by jars121
Tue May 22, 2018 9:24 pm
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

Yes thank you Heater, I read through your links thoroughly yesterday and had a bit more of a play around. I've decided to go with hardware SPI in the end, as I should have enough dedicated hardware SPI channels to accommodate. I've currently got the chain of TLC5971 drivers connected to spidev0.1 al...
by jars121
Mon May 21, 2018 12:39 pm
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

Thanks jahboater, I've done some reading now on sysconf, and it does provide 4096 as the page size :) Despite resolving the issues I was having with bit banging, I'm afraid my problem isn't yet solved. I've measured the frequency of execution of my c code and it's running at around 12.5k executions/...
by jars121
Mon May 21, 2018 7:08 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

There is a problem in your initMapMem function. The second mmap() parameter is the page size for the map. You are passing 0x84 (132 ) as the value. This should be 4096. This is a fixed value, so you could use a constant, but you don't need to pass it. e.g. static uint32_t * initMapMem(int fd, uint3...
by jars121
Sun May 20, 2018 7:35 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

I made it sound more dire than it is to be honest. I could use SPI for these LEDs, but I'd really rather not. I only have 12 of them, so really find it hard to believe that I can't reliably bit bang 84 bytes of data at sufficient frequency to drive them. I've gone back to the sysfs method just to co...
by jars121
Sun May 20, 2018 6:57 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

If I were to look at using hardware SPI instead, how would that work given that these devices don't have a CS pin? Would I manually pull down one of the RPi CS pins, write the data (using the existing MOSI and CLK channels), and then pull the 'fake' CS pin HIGH? I'd really like to avoid hardware SPI...
by jars121
Sun May 20, 2018 5:03 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

That's a very fair point. I will have numerous other SPI devices in use in the very near future, and would prefer to keep these drivers separate if at all possible. Another consideration is the fact that I'll be moving to a non-RPi Linux device in the near future as well, the SPI details of which I ...
by jars121
Sun May 20, 2018 4:33 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

I've spent most of today trying to get this to work to no avail unfortunately. What I have done however, is use joan's excellent c file as the basis for a bare minimum example, where I simply build each of the 3 LED driver registers, setting each LED to the colour red (RGB(65535, 0, 0)), and then wr...
by jars121
Sun May 20, 2018 12:27 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

There must be dozens of examples of interfacing with those registers. Here is a small example of mine. http://abyz.me.uk/rpi/pigpio/examples.html#Misc_minimal_gpio Thanks joan, much appreciated as always. I had sifted through the Tiny GPIO Access example, but somehow missed this one. I've stripped ...
by jars121
Sat May 19, 2018 4:38 am
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Re: Increase GPIO toggle frequency

Ok this is where I'm up to. I've read through this post, and have tried to implement something similar into my existing application and class structure. My current .h and .cpp files are as follows (trimmed down for relevancy). register.h: class register : public QObject { Q_OBJECT public: explicit r...
by jars121
Fri May 18, 2018 11:31 pm
Forum: C/C++
Topic: Increase GPIO toggle frequency
Replies: 24
Views: 2229

Increase GPIO toggle frequency

GPIO toggle frequency has covered before, I know, and I've read through most of those topics. Having not delved into lower level programming (e.g. mmap) before, I want to see whether I have any options available to me other than interfacing directly with registers. A bit of context: I'm writing data...
by jars121
Fri May 18, 2018 3:12 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Sending data to a device register with c++ (Linux)
Replies: 1
Views: 199

Re: Sending data to a device register with c++ (Linux)

Never mind, I had an additional bit in the header by mistake!
by jars121
Fri May 18, 2018 2:09 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Sending data to a device register with c++ (Linux)
Replies: 1
Views: 199

Sending data to a device register with c++ (Linux)

I'm attempting to interface with a TLC5971 RGB LED driver, the datasheet for which is here . I've used this Arduino example as a guide, but I'm unable to make it work on my RPi2. I have 3 LED drivers in series, but am trying to communicate with a single driver to start with. Below is what I have so ...
by jars121
Wed Apr 18, 2018 10:11 pm
Forum: Graphics programming
Topic: Cross-compilation guide for Qt 5.9.4 and RPi
Replies: 50
Views: 43478

Re: Cross-compilation guide for Qt 5.9.4 and RPi

Never mind, I went through it again and paid much closer attention and have it running again with 5.9.4 :D
by jars121
Sun Apr 15, 2018 9:16 am
Forum: Graphics programming
Topic: Cross-compilation guide for Qt 5.9.4 and RPi
Replies: 50
Views: 43478

Re: Cross-compilation guide for Qt 5.9.4 and RPi

My setup has been running very nicely since my original posts back in February, but I've now run into a problem. I've wiped my machine and installed Windows (not by choice believe me), with a virtual Ubuntu 16.04 instance (using Oracle VirtualBox) for Qt development. I've spent the better part of 2 ...
by jars121
Mon Mar 05, 2018 8:46 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Modifying 10-bit c++ SPI code for a 12-bit device
Replies: 6
Views: 941

Re: Modifying 10-bit c++ SPI code for a 12-bit device

My apologies joan but you've lost me there.

Isn't the first meaningful returned byte (byte 2) specified as being

Code: Select all

???0B11B10B9
? Is the SPI command in this instance a2d.spiWriteRead(data, sizeof(data))?
by jars121
Mon Mar 05, 2018 8:30 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Modifying 10-bit c++ SPI code for a 12-bit device
Replies: 6
Views: 941

Re: Modifying 10-bit c++ SPI code for a 12-bit device

Thank you both for your replies, they're greatly appreciated as always :) To confirm, to replace the data[0], data[1] and data[2] lines in the sample code pasted above, for my 12-bit device measuring in single ended mode for channel 0, I would have the following: data[0] = 0b00000110 data[1] = 0b000...
by jars121
Sun Mar 04, 2018 7:54 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Modifying 10-bit c++ SPI code for a 12-bit device
Replies: 6
Views: 941

Modifying 10-bit c++ SPI code for a 12-bit device

I'm referencing this post to connect to an MCP3208 12-bit ADC. The linked post uses an MCP3008, which is only a 10-bit ADC, so sending/receiving SPI data is slightly different. Here is the 10-bit code: mcp3008Spi a2d("/dev/spidev0.0", SPI_MODE_0, 1000000, 8); int a2dVal = 0; int a2dChannel = 0; unsi...
by jars121
Sat Feb 24, 2018 5:05 am
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 5249

Re: c++ GPIO interrupt approach

Bit of an update. I've had my source connected to the oscilloscope, and there doesn't appear to be any reason why the RISING_EDGE detection shouldn't work given the input signal. I'm happy with the FALLING_EDGE method however, which displays the same calculated frequency as my oscilloscope. I've mov...

Go to advanced search