Hello,
I am pushing consequently several (14) integer words into GPIO6 in a loop. Right now one GPIO6 update takes two clocks, and I would like to do it in one clock. Data in these integer words organized such a way that each port bit updates only twice during 14 storage's, so, each GPIO port run at 30-70MHz but I would like to play with the phase as accurate as possible. AFAIK, I am retrieving data to the register that takes one clock tick, and one GPIO6 update the next clock tick. Please, advice me is there any possibility to do this twice faster, and preferably with 28 integer words?
The complete code is below.
Sure I played already with optimization, but it does not help a lot.
Thank you
I am pushing consequently several (14) integer words into GPIO6 in a loop. Right now one GPIO6 update takes two clocks, and I would like to do it in one clock. Data in these integer words organized such a way that each port bit updates only twice during 14 storage's, so, each GPIO port run at 30-70MHz but I would like to play with the phase as accurate as possible. AFAIK, I am retrieving data to the register that takes one clock tick, and one GPIO6 update the next clock tick. Please, advice me is there any possibility to do this twice faster, and preferably with 28 integer words?
The complete code is below.
Sure I played already with optimization, but it does not help a lot.
Thank you
Code:
// #pragma GCC push_options
// #pragma GCC optimize ("Ofast")
#include <Arduino.h>
void RunRealExcitationOne()
{ unsigned int A0=0x22a20002;
unsigned int A1=0x22860002;
unsigned int A2=0x2a840002;
unsigned int A3=0x0a940002;
unsigned int A4=0x0a150002;
unsigned int A5=0x18150002;
unsigned int A6=0x18510002;
unsigned int A7=0x11510002;
unsigned int A8=0x11490002;
unsigned int A9=0x15480002;
unsigned int A10=0x05680002;
unsigned int A11=0x052a0002;
unsigned int A12=0x242a0002;
unsigned int A13=0x24a20002;
unsigned char i=255;
do
{ GPIO6_DR=A0;
GPIO6_DR=A1;
GPIO6_DR=A2;
GPIO6_DR=A3;
GPIO6_DR=A4;
GPIO6_DR=A5;
GPIO6_DR=A6;
GPIO6_DR=A7;
GPIO6_DR=A8;
GPIO6_DR=A9;
GPIO6_DR=A10;
GPIO6_DR=A11;
GPIO6_DR=A12;
GPIO6_DR=A13;
i--;
} while(i);
}
void setup()
{
while(!Serial); // wait for serial port to connect
if (CrashReport) {
Serial.print(CrashReport);
delay(5000);
}
Serial.println("We are starting...");
pinMode(23, OUTPUT);
pinMode(22, OUTPUT);
pinMode(21, OUTPUT);
pinMode(20, OUTPUT);
pinMode(19, OUTPUT);
pinMode(18, OUTPUT);
pinMode(17, OUTPUT);
pinMode(16, OUTPUT);
pinMode(15, OUTPUT);
pinMode(14, OUTPUT);
pinMode(41, OUTPUT);
pinMode(40, OUTPUT);
pinMode(39, OUTPUT);
pinMode(38, OUTPUT);
}
void loop()
{ unsigned long t1, t2;
t1=ARM_DWT_CYCCNT;
for(unsigned char i=0; i<128; i++)
RunRealExcitationOne();
t2=ARM_DWT_CYCCNT;
Serial.printf("Times: %ld\n", (t2-t1)/255/128);
delay(1000);
}
// #pragma GCC pop_options