Go to advanced search

by rzusman
Sun Jan 13, 2019 4:41 pm
Forum: General programming discussion
Topic: smoother RGBW LED fading
Replies: 5
Views: 194

Re: smoother RGBW LED fading

I made an PWM LED dimmer for a friend’s art project, using a Silicon Labs processor. The 8-bit PWM looked fine, until the LEDs were very dim, and then the last 8-10 steps or so were very abrupt. When I used the 16-bit PWM, the fades were perfectly smooth, all the way to zero brightness. So, PWM gran...
by rzusman
Sun Jan 06, 2019 12:11 am
Forum: HATs and other add-ons
Topic: battery powered pi, implement real power button?
Replies: 10
Views: 373

Re: battery powered pi, implement real power button?

You need to re-think your circuit. Having the 5v regulator powered all the time is going to kill your battery. That regulator has something like 5mA or quiescent current. Also, you need to be careful about low-side switching. Once you pull the ground, your device naturally floats to Vcc, since the t...
by rzusman
Fri Jan 04, 2019 12:52 am
Forum: HATs and other add-ons
Topic: battery powered pi, implement real power button?
Replies: 10
Views: 373

Re: battery powered pi, implement real power button?

Don’t dismiss using a separate micro controller as a supervisor so fast...

You can get a tiny micro for a buck or so, and it can handle all the logic.
by rzusman
Tue Jan 01, 2019 10:53 pm
Forum: HATs and other add-ons
Topic: battery powered pi, implement real power button?
Replies: 10
Views: 373

Re: battery powered pi, implement real power button?

Here’s what I did for my Compute Module design: I have a Supercap backup power supply that allows graceful shutdown. In your case, this would be your batteries. I use a separate micro controller to monitor the state of the supercap charge. Once they are fully charged, I enable my 3.3v and 5v switchi...
by rzusman
Tue Jan 01, 2019 12:52 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: How to connect 20 stepper motors to Raspberry Pi 3b+ ?
Replies: 2
Views: 555

Re: How to connect 20 stepper motors to Raspberry Pi 3b+ ?

You could use something like this: https://www.pololu.com/product/2971

And then connect the enable pin to a serial-in, parallel out shift register, or a port expander.
by rzusman
Mon Dec 31, 2018 5:50 pm
Forum: Compute Module
Topic: Installing software on CM3
Replies: 6
Views: 416

Re: Installing software on CM3

Yes the module is able to boot with raspbian lite, but I thought that files (such as git clones) could be put on the compute module over the usb slave port? If you follow the instructions PhilE posted above, you should be able to mount the CM as two volumes. Then (from a Linux host), you can just c...
by rzusman
Wed Dec 26, 2018 8:28 pm
Forum: Compute Module
Topic: Installing software on CM3
Replies: 6
Views: 416

Re: Installing software on CM3

It does not help me, I have the OS up and running. I just don't know how to install software on it. I want to use pip3 to install opencv. Since there is no internet connection, I am having issues. Wait. Do you mean that the CM is up and running? If so, get a USB-Ethernet converter, or a USB-WiFi do...
by rzusman
Sun Dec 23, 2018 2:20 am
Forum: Compute Module
Topic: RTC time is drifting within one day
Replies: 3
Views: 986

Re: RTC time is drifting within one day

Frankly, the DS1307 accuracy stinks.

Spend the extra money and get the DS3231, which is temperature compensated, and is guaranteed accurate to a a minute or so/year.

http://www.reuk.co.uk/wordpress/accurat ... to-ds1307/
by rzusman
Tue Nov 27, 2018 2:31 am
Forum: General discussion
Topic: Toggling GPIO pins for pulse width of <100ns
Replies: 35
Views: 921

Re: Toggling GPIO pins for pulse width of <100ns

Raspbian IS Linux...
by rzusman
Mon Nov 26, 2018 11:23 pm
Forum: General discussion
Topic: Toggling GPIO pins for pulse width of <100ns
Replies: 35
Views: 921

Re: Toggling GPIO pins for pulse width of <100ns

At a clock speed of 1.4Ghz, that's 100 instructions (more or less). From C, using something like WiringPi, you should easily be able to toggle a pin that quickly. BUT: if you are doing this in Linux, there is a non-zero chance that your pulse will be stretched to some very long duration (10mS or mor...
by rzusman
Mon Nov 26, 2018 12:44 am
Forum: General programming discussion
Topic: Picture frame project, managing files
Replies: 7
Views: 2396

Re: Picture frame project, managing files

What scripting language are you using?
It would be pretty simple to do a brute-force check in Python.
by rzusman
Wed Nov 21, 2018 6:06 pm
Forum: Beginners
Topic: GPIO pulse in nanoseconds
Replies: 7
Views: 830

Re: GPIO pulse in nanoseconds

Have you ‘scoped the output? That’s the only way to be sure of the pulse rise time, width, and fall time.
by rzusman
Wed Nov 21, 2018 5:44 pm
Forum: Beginners
Topic: GPIO pulse in nanoseconds
Replies: 7
Views: 830

Re: GPIO pulse in nanoseconds

I’d be willing to bet that it’s impossible to generate a pulse that’s narrower than 3nS with a user-space program on the Pi.
Even at 1.4 GHz, that’s only around 4.2 clocks, and there’s going to be way more cycles than that with the function call overhead.
by rzusman
Sun Nov 18, 2018 9:34 pm
Forum: Advanced users
Topic: Check for crashed program periodically?
Replies: 5
Views: 517

Re: Check for crashed program periodically?

You can create a system service that will re-launch a crashed process automatically.

https://medium.com/@benmorel/creating-a ... 1b5c8b91d6

This won’t fix a hung process - you need a watchdog for that.
by rzusman
Thu Nov 15, 2018 4:27 am
Forum: Compute Module
Topic: Possibility connect compute module directly by solder wire directly to its 'connector'.
Replies: 4
Views: 1715

Re: Possibility connect compute module directly by solder wire directly to its 'connector'.

Your time must be worth more than a socket...

I could solder wires to the CM edge connector, but it would take hours to cut and strip all the wires and solder them. Also, the USB connector probably wouldn’t work with pigtail leads - it needs to be controlled impedance.
by rzusman
Sat Nov 03, 2018 12:16 am
Forum: C/C++
Topic: pthread leak?
Replies: 4
Views: 1058

Re: pthread leak?

Don't use a blocking read. Use something like select with a timeout.

Some discussion here: https://stackoverflow.com/questions/634 ... gracefully
by rzusman
Tue Oct 30, 2018 2:08 am
Forum: C/C++
Topic: What does mtkime with tm_isdst = -1 do during DST transition?
Replies: 1
Views: 1025

What does mtkime with tm_isdst = -1 do during DST transition?

I just found a bug in my code, due to me not explicitly setting tm_isdst to -1 when updating the time using mktime. It took me a long time to detect, since I live in Arizona, and we don’t observe DST. Changing the time update routine to have tm_isdst = -1 seems to fix the time update issue I was hav...
by rzusman
Sat Oct 27, 2018 10:36 pm
Forum: Compute Module
Topic: RS485 Communication with Pi Compute 3L
Replies: 18
Views: 2653

Re: RS485 Communication with Pi Compute 3L

Thanks for the link, and I may experiment with it when I have the time, but I'm not sure it will do what I want. The RTS/CTS lines are controlled by the buffer state, as I understand it, and are not really what I want , which is a TE signal that is the exact width of one byte, including the start an...
by rzusman
Sat Oct 27, 2018 5:34 pm
Forum: Compute Module
Topic: RS485 Communication with Pi Compute 3L
Replies: 18
Views: 2653

Re: RS485 Communication with Pi Compute 3L

I use RS-485 on the CM3L. I am using a low baud rate (9,600), so my timing may not be as critical as yours, but I ended up manually controlling the TE input of the RS-485 driver (Enable TE, send data, disable TE). The only way I was able to do that was to put the driver thread to sleep for 10mS, jus...
by rzusman
Thu Oct 11, 2018 12:59 am
Forum: C/C++
Topic: Valgrind
Replies: 21
Views: 1311

Re: Valgrind

Thanks for the suggestions.
The code is quite complicated - it’s a scheduler for controlling industrial lighting, and it communicates via RS-485 and cellular modems. Maybe 20,000 lines of C.

Anyway, I’ll spend some time trying to figure out what is slowing down valgrind so much when I get a chance.
by rzusman
Sat Oct 06, 2018 3:17 pm
Forum: C/C++
Topic: Valgrind
Replies: 21
Views: 1311

Re: Valgrind

I'm testing this on the Compute Module 3 lite.
by rzusman
Fri Oct 05, 2018 9:43 pm
Forum: C/C++
Topic: Valgrind
Replies: 21
Views: 1311

Re: Valgrind

OK, so I upgraded from 3.7 to 3.13 (apt-get installs 3.7), and that stopped all the bazillion errors before main().
It's still really slow, but I can figure out how to deal with that.
by rzusman
Fri Oct 05, 2018 2:49 pm
Forum: C/C++
Topic: Valgrind
Replies: 21
Views: 1311

Re: Valgrind

I'll look at some of the suggestions later, but as an example, valgrind is emitting thousands of errors like this: ==857== 2 errors in context 110 of 270: ==857== Use of uninitialised value of size 4 ==857== at 0x401AB20: memcpy (memcpy.S:339) ==857== by 0x400BBE7: _dl_new_object (dl-object.c:87) ==...
by rzusman
Fri Oct 05, 2018 12:25 am
Forum: C/C++
Topic: Read UART Packet
Replies: 5
Views: 708

Re: Read UART Packet

Your code is going to read bytes as they are sent. So, what you should see is something like: 41 No data on port No data on port No data on port be No data on port No data on port No data on port No data on port No data on port 2 No data on port No data on port No data on port No data on port No dat...
by rzusman
Thu Oct 04, 2018 10:48 pm
Forum: C/C++
Topic: Valgrind
Replies: 21
Views: 1311

Valgrind

Based on a hint from a recent thread, I installed valgrind and ran it on my software. It found thousands of "Use of uninitialised value" errors - even before my software ran! Seems like the GCC pre-main code is full of "iffy" code. Anyway, it also found a whole bunch of these in my main function, ev...

Go to advanced search