Statistics: Posted by costaud — Wed Mar 11, 2015 2:26 am
jcmvbkbc wrote:As a side note, you can have up to twice as fast GPIO control if you specify -mno-serialize-volatile in gcc flags.
Statistics: Posted by jcmvbkbc — Sun Mar 08, 2015 1:45 am
jcmvbkbc wrote:As a side note, you can have up to twice as fast GPIO control if you specify -mno-serialize-volatile in gcc flags.
Code:
asm volatile (
"s32i %0, %1, 4\n\t"
"s32i %0, %1, 8\n\t"
"s32i %0, %1, 4\n\t"
"s32i %0, %1, 8"
: : "r"(0x00001000), "r"(0x60000300) : "memory");
Statistics: Posted by jcmvbkbc — Sat Mar 07, 2015 3:31 pm
Statistics: Posted by raz123 — Sat Mar 07, 2015 9:05 am
zerog2k wrote:Maybe there is a better way to control low level timer through registers, etc, but dont see any good documentation on this yet - I would like to know too
Statistics: Posted by jcmvbkbc — Sat Mar 07, 2015 5:06 am
Statistics: Posted by raz123 — Sat Mar 07, 2015 5:02 am
Statistics: Posted by zerog2k — Fri Mar 06, 2015 10:42 pm
rudi wrote:@jcmvbkbc
do you know how much / when overflow ( register bit ) can read , too?
have me a interupt for this?
can we trigger this?
jcmvbkbc wrote:
- is overflow of CCOUNT detectable? -- no, there's nothing that can tell you about an overflow. No interrupt, no overflow bit.
jcmvbkbc wrote:
- is there an interrupt for CCOUNT? Yes, there is a number of CCOMPARE SRs. You can write a value there and then an IRQ will be raised once CCOUNT reaches that value.
jcmvbkbc wrote:
For more details please see xtensa ISA book (e.g. http://0x04.net/~mwk/doc/xtensa.pdf ), 4.4.6 Timer interrupt option.
Code:
..
t1 = system_get_time(); // API get time
// start
tick1 = get_ccount(); // Spezial Register CCOUNT get and save
while (mtick < 10 )
{
asm ("nop");
mtick++;
}
t2 = system_get_time(); // API get time
tickdiff = tick2 - tick1; // How much Ticks used
..
..
Statistics: Posted by rudi — Fri Mar 06, 2015 3:43 am
Statistics: Posted by jcmvbkbc — Fri Mar 06, 2015 12:58 am
piotrva wrote:Is there any way to get an interrupt at 50us resolution or to get a tick count at 50us resolution?
Code:
static inline unsigned get_ccount(void)
{
unsigned r;
asm volatile ("rsr %0, ccount" : "=r"(r));
return r;
}
Code:
..
static inline unsigned get_ccount(void);
..
static inline unsigned get_ccount(void)
{
unsigned r;
asm volatile ("rsr %0, ccount" : "=r"(r));
return r;
}
void user_init(void)
{
while(1)
{
char ticks1 [32];
char ticks2 [32];
unsigned tick1;
unsigned tick2;
unsigned tickdiff;
tick1 = get_ccount(); // Spezial Register CCOUNT call and save
tick2 = get_ccount(); // Spezial Register CCOUNT call and save
tickdiff = tick2 - tick1; // how much ticks was used
// 1. Register CCOUNT formated transfer to Variable
os_sprintf(ticks1, "%lu", tick1);
// 2. Register CCOUNT formated transfer to Variable + Diff Value
os_sprintf(ticks2, "%lu %lu", tick2, tickdiff);
// ich hab neben dem OLED am SPI auch ein MCP23S17 über SPI am ESP8266
// und betreibe ein einfaches 16 Zeichen x 2 Display daran
// daher ganz simple LCD Ausgabe anstatt Uart
// i have used a MCP23S17 ( SPI Portexpander ) with ESP8266 and use a 8bit LCD for Display
// LCD output for ticks, uart0 for Debug prints
//
lcdCmd(clearDisplay); // LCD Command Clear Display
lcdGoto(0); // LCD Command Go Postion 0
lcdWriteString(ticks1); // LCD Print Register CCOUNT Total Ticks
lcdGoto(0x40); // LCD Command Go Postion 0x40 (second row)
lcdWriteString(ticks2); // LCD Print Register CCOUNT total Ticks
os_delay_us(10 *1000*1000); // Pause : for me to read value at LCD
lcdCmd(ClearDisplay); // LCD Command Clear Display
} // while
} // user_init
Code:
..
tick1 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
os_delay_us(1);
tick2 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
tickdiff = tick2 - tick1; // Wieviel Ticks verbraucht
..
// tickdiff 122
Code:
..
tick1 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
os_delay_us(2);
tick2 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
tickdiff = tick2 - tick1; // Wieviel Ticks verbraucht
..
//tickdiff 194
Code:
..
tick1 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
os_delay_us(1);
os_delay_us(1);
tick2 = get_ccount(); // Spezial Register CCOUNT Abruf und Übertrag
tickdiff = tick2 - tick1; // Wieviel Ticks verbraucht
..
// tickdiff 243
Statistics: Posted by rudi — Thu Mar 05, 2015 10:42 pm
Statistics: Posted by piotrva — Sun Feb 15, 2015 10:18 pm
Code:
#ifdef USE_US_TIMER
#define os_timer_arm_us(a, b, c) ets_timer_arm_new(a, b, c, 0)
#endif
#define os_timer_arm(a, b, c) ets_timer_arm_new(a, b, c, 1)
Statistics: Posted by piotrva — Sun Feb 15, 2015 6:35 pm
Statistics: Posted by costaud — Sun Feb 15, 2015 11:43 am
Code:
static inline unsigned get_ccount(void)
{
unsigned r;
asm volatile ("rsr %0, ccount" : "=r"(r));
return r;
}
Statistics: Posted by jcmvbkbc — Sat Feb 14, 2015 8:48 pm
Statistics: Posted by piotrva — Sat Feb 14, 2015 6:52 am