Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@joan, Can give me a library or another method to can write GPIO under 1 microsecond using C or bare metal that you mentioned. Before that, This program has been written on Arduino mega2560 (using Timer 16Mhz) and it run well.
Actually, I don't know what do now. I tried many how as use I2C slow speed library, add core_freq=250 in /boot/config.txt, update as well as upgrade firmware and read many documents about timing bugs... Consequently, that all didn't improve for this. Besides that, when I tried to use "set_PWM_frequency" is that I got an accurate frequency of 40 kHz. In the other hand, if I generate by the wavePWM library, then it will be error
This programming quite important with me since It's my thesis. This September I must defend so I really sad. Can you give me a specific method to can resolve this problem? It seems to be stretched about 5 us for all case (For example if 40 kHz (T=25us) is that T got = 30 us).
I tried to add core_freq=250 as you suggested but it seems not fixed. The frequency about 35.5 kHz (not 40khz as I want to). I using Raspi 2 mode B. and an Ethernet port via putty to control it. Whether that can the ethernet port lead to this problem? My Rasp was failed last week, so I formatted SD card and re-install Raspian for it. But before it worked quite well. Any recommend for me now? thanks Joan very much
thanks @joan, I have generated with 1us sampling start successfullly. I have a question for you if I want start time have resolution about 0.5us is your new class can do thing? seem it only can generate to 1us is smallest?
in your new class, it can create a start time have resolution to 1us? (Example I want start time for pulse on GPIO 1 is 2 and for GPIO 2 is 3 =>> phased delay between them is 1 us but it only dislay 5us) . I tried but picscope only display the min resolution is 5us with any phase delay between two pulses is a number not divisible by 5 as in figure: imgur.com/a/q26fi