minilogic / f1c_nonos

Bare metal code examples for Allwinner's F1C100S (F1C200S) SOC
71 stars 27 forks source link

f1c100s udelay() #7

Open satar1980 opened 1 week ago

satar1980 commented 1 week ago

I made the following code, but it only outputs 333khz not 500khz :

while(1){
            //make blink on pin E0
    PIN_E0_HIGH();
    udelay(1);
    PIN_E0_LOW();
    udelay(1);
}

can you fix it sir

minilogic commented 1 week ago

I have a very simple implementation of udelay. Change this function: void udelay (u32 us) { for(u32 tmp = ctr_us + us; ctr_us < tmp; ) {}; }

satar1980 commented 1 week ago

I have used this code, with avs timer init just make 300khz void udelay (u32 us) { for(u32 tmp = ctr_us + us; ctr_us < tmp; ) {}; }

and if I use timer0 the result is worse under 200khz