Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-09 Thread Charles Steinkuehler
As mentioned, you can't really tell what a compiler is going to turn your C code into. As you discovered, the v2 code that is actually more suited to the PRU low-level assembly instructions turns into worse assembly because of the compiler. I suspect you have at least two problems with your

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-08 Thread Fred Gomes
Hi Charles, thank you very much for your answer, I followed your advice but something overly odd is happening. First of all, let me contextualize you: the image sensor is always sending data through the CS, SCLK, and MOSI pins. The delay between each frame is about 10 ms. That said, I wrote the

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-07 Thread Charles Steinkuehler
On 12/7/2018 3:52 AM, Fred Gomes wrote: > > Here's the code where I got the better results: > > while(__R31); // CS = 1 > > while(__R31){ //sclk = 1 > > if(__R31){ > goto END;} > } > while(!(__R31)); //SCLK = 0 > var = (__R31)? var |(0x01 << shift): var; > > k++; > shift--; > > if(shift ==

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-07 Thread Fred Gomes
Hi Gerhard, Thank you very much for your answer. In fact, I did not have the CS and Clock pins defined as "define", I made the program a way faster. Another tip that improved the program's performance a lot is to access the storage array through a pointer, rather than a direct indexation, like

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-04 Thread Gerhard Hoffmann
Am 04.12.18 um 10:25 schrieb fred.p.gome...@gmail.com: Hi, I need your help, I need to read data of an SPI Master device on the BeagleBone. Since the SPI kernel driver doesn't support an SPI slave mode I have to implement it in the PRU (Because the maximum frequency one BeagleBone's GPIO

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-04 Thread Charles Steinkuehler
Try writing in assembly, or at least providing a listing of the PRU code your compiler is generating. The C code you've written could turn into very ugly assembly with a lot of memory reads (which are *VERY* expensive on the PRU) depending on the compiler. In general, for speed you only want the

Re: [beagleboard] Can't get SPI data up to 10 MHz - PRU

2018-12-04 Thread Fred Gomes
I've forgotten to mention. I am sending the clocks from the PRU 1 to PRU 0 at this time. So I know exactly how many clocks there is and the frequency. The objective is to plug the sensor which I want to read the data after having this working . -- Fred Gomes escreveu no dia terça, 4/12/2018