Go to advanced search

by tjrob
Tue Apr 28, 2020 1:35 pm
Forum: Advanced users
Topic: ADC, DAC, and noise
Replies: 9
Views: 645

Re: ADC, DAC, and noise

The OPA350 driving a 10uF load came from the TI application note on voltage references. It works, and is not at all unstable. The output slew rate is reduced, so it does need to be quasi-dc output. The low-pass filter preceding the OPA350 was chosen as a trade-off between output noise and settling t...
by tjrob
Tue Apr 28, 2020 3:45 am
Forum: Advanced users
Topic: ADC, DAC, and noise
Replies: 9
Views: 645

Re: ADC, DAC, and noise

Grounding in a system must always be treated with care, especially when some components are sensitive at the microvolt level. It is essential to ensure that only signal currents go through the shields of signal-carrying coax. While using balanced cables would be desirable, we are constrained by the ...
by tjrob
Sun Apr 26, 2020 3:08 pm
Forum: Advanced users
Topic: ADC, DAC, and noise
Replies: 9
Views: 645

Re: ADC, DAC, and noise

Opto-isolating the I2C bus for the DACs is easy, as they are write-only. But it did not help -- the RPi networking still put millivolt-level noise into the DAC outputs. I2C traffic also put noise into the DAC output, but that can be avoided by using a separate I2C bus for each DAC.
by tjrob
Fri Apr 17, 2020 8:26 pm
Forum: Advanced users
Topic: ADC, DAC, and noise
Replies: 9
Views: 645

ADC, DAC, and noise

I am building a scientific instrument that is sensitive to noise at the few-microvolt level on the DAC outputs. Noise below a millivolt is not a problem on the ADC, and that is straightforward so I won't discuss it. This is not audio, and sampling at 800 Hz is adequate. I'm using Raspberry Pi 3B+ --...
by tjrob
Fri Apr 03, 2020 5:29 pm
Forum: Advanced users
Topic: Raspberry Pi puts noise into ADC and DAC
Replies: 1
Views: 215

Raspberry Pi puts noise into ADC and DAC

I have been fighting noise in my ADC and DAC, connected to a RPi 3B+. I am assembling a scientific instrument, and the need is to sample a 16-bit ADC at 860 - 1000 Hz, and also drive a 12- to 16-bit DAC more slowly. The idea is to digitally ramp the DAC output and monitor the instrument's response w...
by tjrob
Mon Sep 09, 2019 7:06 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: different execution times spi request
Replies: 5
Views: 383

Re: different execution times spi request

To achieve 200kB/sec via SPI you will need to write full-blown Linux driver using DMA. Even then you will be pushing realtime limits. This is about the limit for a simple code loop: In C++ using a dedicated CPU3 on a Raspberry Pi 3B+ I am able to achieve 1000 samples per second for 4 channels of an ...
by tjrob
Mon Sep 09, 2019 5:13 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Connection to DAC/ADC with SDIO
Replies: 1
Views: 695

Re: Connection to DAC/ADC with SDIO

I don't understand your question. SPI is inherently bidirectional -- whenever you write a byte, you also read a byte. On an ADS1256, while writing the configuration you ignore the bytes it sends to you; once you have told it to send the data, it ignores the bytes you send to it.
by tjrob
Mon Sep 09, 2019 5:03 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: SPI interface for ADS1278 using BCM Library
Replies: 1
Views: 306

Re: SPI interface for ADS1278 using BCM Library

I doubt very much that you can achieve 52734 samples per second on 8 channels without a complicated driver using DMA. Even that may not be possible, as SPI is a rather slow serial bus (though it is faster than I2C). In C++ using a dedicated CPU3 on a Raspberry Pi 3B+ I am able to achieve 1000 sample...
by tjrob
Mon Sep 09, 2019 4:43 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Beware: power sequencing
Replies: 1
Views: 350

Beware: power sequencing

I'm using a Raspberry Pi and an ADS1115 ADC to measure an input voltage in the range -3V to +3V, sampled at 500 Hz. As the ADS1115 has a range of 0 to +3.3V this requires an op-amp level shifter. I used this circuit (with the ADS1115 connected to the RPi's I2C bus): Screen Shot 2019-09-08 at 10.48.4...
by tjrob
Fri Aug 23, 2019 1:48 am
Forum: Advanced users
Topic: Pimoroni pHAT DAC in C++?
Replies: 1
Views: 280

Pimoroni pHAT DAC in C++?

I have a project that must be written in C++, and I want to use the Pimoroni pHAT DAC. I have the hardware working, and some Python code correctly outputs to the DAC. (I am using this for a scientific instrument, not audio; this is one of the few audio DACs that can output dc levels, -3V to +3V.) Do...
by tjrob
Thu Jun 20, 2019 2:13 am
Forum: Camera board
Topic: CameraApp - A Simple Raspberry Pi Camera Application
Replies: 0
Views: 683

CameraApp - A Simple Raspberry Pi Camera Application

As this community has helped me so much, I thought I'd contribute my simple but fairly comprehensive camera app for full-resolution still pictures. It shows you how to do many useful things in Python with the RPi camera module. All of this is available elsewhere, but scattered around in very many pl...
by tjrob
Sun Jun 09, 2019 7:28 pm
Forum: Camera board
Topic: Pi Camera V2 failed to enable component: ENOSPC - failed imx219.c::imx219_op
Replies: 5
Views: 2389

Re: Pi Camera V2 failed to enable component: ENOSPC - failed imx219.c::imx219_op

I had the same ENOSPC problem when using picamera in python3 for single (still) images. I found two workarounds: 1. reduce the resolution -- it failed at 3280x2464, but succeeded at 1024x768 2. increase the amount of GPU memory. The default is 128 MB; 192MB permits 3280x2464. (do this in the Perform...
by tjrob
Sun Jun 09, 2019 7:28 pm
Forum: Camera board
Topic: Camera V2.1: failed to enable component: ENOSPC
Replies: 4
Views: 2387

Re: Camera V2.1: failed to enable component: ENOSPC

I had the same ENOSPC problem when using picamera in python3 for single (still) images. I found two workarounds: 1. reduce the resolution -- it failed at 3280x2464, but succeeded at 1024x768 2. increase the amount of GPU memory. The default is 128 MB; 192MB permits 3280x2464. (do this in the Perform...
by tjrob
Sun Jun 09, 2019 7:02 pm
Forum: Camera board
Topic: Camera not working - failed to enable component: ENOSPC
Replies: 10
Views: 6311

Workarounds: Camera not working - failed to enable component: ENOSPC

I had the same ENOSPC problem when using picamera in python3 for single (still) images. I found two workarounds: 1. reduce the resolution -- it failed at 3280x2464, but succeeded at 1024x768 2. increase the amount of GPU memory. The default is 128 MB; 192MB permits 3280x2464. (do this in the Perform...
by tjrob
Thu Jan 24, 2019 2:39 am
Forum: Advanced users
Topic: SOLVED: How do I get a login prompt on ttyAMA0???
Replies: 2
Views: 1006

SOLVED: How do I get a login prompt on ttyAMA0???

The problem was that in rc.local I had code to set the time via ntpd. But the NTP server was unreachable, and this hung forever. Commenting that out fixed it.

I have no idea why running agetty manually (via ssh) did not work.
by tjrob
Thu Jan 24, 2019 1:00 am
Forum: Advanced users
Topic: SOLVED: How do I get a login prompt on ttyAMA0???
Replies: 2
Views: 1006

Re: How do I get a login prompt on ttyAMA0???

I have verified minicom on my Mac laptop talking to the Adafruit USB<->Serial adapter at 115200 baud. With a jumper from green to white (Tx -> Rx) it correctly echos everything typed in the minicom window; removing the jumper stops the echo (as expected). I then connect the 4 wires to the RPi Zero W...
by tjrob
Wed Jan 23, 2019 4:39 am
Forum: Advanced users
Topic: SOLVED: How do I get a login prompt on ttyAMA0???
Replies: 2
Views: 1006

SOLVED: How do I get a login prompt on ttyAMA0???

How do I get a login prompt on /dev/ttyAMA0??? Note there is A LOT of conflicting information about this on the web and in these forums; much is so old it uses /etc/inittab (not /etc/systemd) This is a Raspberry Pi Zero W running Raspbian stretch, but I also need to know how to do it on a RPi 3B+. u...
by tjrob
Thu Jan 03, 2019 4:20 am
Forum: Other projects
Topic: 150 MHz clock generator using RPi Zero W
Replies: 1
Views: 609

150 MHz clock generator using RPi Zero W

I just built a small clock generator box using a Raspberry Pi Zero W and the Adafruit Si5351 clock-generator board. Works great! It can generate a crystal-stable 3.3V square-wave clock at just about any frequency between 8 kHz and 150 MHz. Total cost was about $25 -- amazing! Note: above about 10 MH...
by tjrob
Mon Dec 24, 2018 3:30 pm
Forum: Advanced users
Topic: RPi won't boot with CPLD powered up
Replies: 2
Views: 1149

Re: RPi won't boot with CPLD powered up

Thanks. That's what I did: make the data bus be high-Z at initialization / power-up.
by tjrob
Sun Dec 23, 2018 4:34 pm
Forum: Advanced users
Topic: RPi won't boot with CPLD powered up
Replies: 2
Views: 1149

RPi won't boot with CPLD powered up

I built a 200 MHz frequency counter in a CPLD. It uses a 20-bit data-output bus plus three control signals, which I connected to GPIOs 2-24 on a RPi 3B+. Note that all bits of the data bus will vary high/low at 1 kHz, independent of the RPi. With the CPLD powered up, the RPi won' t boot. Once it is ...
by tjrob
Sun Dec 23, 2018 1:02 am
Forum: Advanced users
Topic: Solution: Dedicating one core to a real-time process
Replies: 12
Views: 5757

Re: Solution: Dedicating one core to a real-time process

That latency program doesn't actually do anything in the real-time process. In particular, it does not do the fprintf(socket, ...). Actually using it, I learned what should have been obvious -- network flow control can back up and block the fprintf(), causing it to miss samples. Fortunately there is...
by tjrob
Tue Dec 11, 2018 2:48 am
Forum: Advanced users
Topic: Solution: Dedicating one core to a real-time process
Replies: 12
Views: 5757

Re: Solution: Dedicating one core to a real-time process

The code attachment got lost. Here it is.

I also forgot to show how to build the latency program:

Code: Select all

g++ -o latency latency.cc Realtime.cc -lpigpio -lpthread
by tjrob
Tue Dec 11, 2018 2:45 am
Forum: Advanced users
Topic: Solution: Dedicating one core to a real-time process
Replies: 12
Views: 5757

Solution: Dedicating one core to a real-time process

Linux is most definitely not a real-time operating system, and if you just use the default configuration you'll find you occasionally have latencies as large as 50 milliseconds. That's pretty hopeless for anything that needs real-time response. You can certainly install some real-time OS, or write a...
by tjrob
Sun Oct 07, 2018 6:43 pm
Forum: Advanced users
Topic: Trouble with real-time code
Replies: 15
Views: 2562

Re: Trouble with real-time code

I assume that your program sets its scheduler to SCHED_FIFO and high priority. By default the kernel does not permit such real-time processes to starve other, non-realtime processes, so once per second it pauses the realtime process for 50 ms. As you observed. Here is my code to avoid this: #include...
by tjrob
Sun Oct 07, 2018 5:51 pm
Forum: Advanced users
Topic: Change max CPU freq without rebooting
Replies: 2
Views: 3352

Re: Change max CPU freq without rebooting

As already mentioned, the various govenors can be used to affect the CPU frequency changes. In Raspbian there is a more direct way, which can be done without reboot. The files in /sys/devices/system/cpu/cpu0/cpufreq directly control the kernel's turbo mode, which is what changes the CPU clock freque...

Go to advanced search