Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wanted : developers (alive)
18-01-2013, 01:10 PM,
#11
RE: Wanted : developers (alive)
Hi,
8-bit Pinguino users will be soon able to virtually run every PIC18F processor (with or without built-in USB module) at every clock speed available (from 31KHz to 64MHz on some chips). To be specific, from a developer's point of view, it means we have to get this speed to keep some libraries going. That's what we managed to do. We still have to write accurate delay routines according to the clock speed. Is there someone to help us on that ? Thank you.
Régis
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
01-01-2014, 08:14 PM,
#12
RE: Wanted : developers (alive)
Hi,
A little comment about this point.
I just have noticed that the timer 0 on Pinguino 47j53-A run approximately 10 time faster as expected.
I discovered the problem when testing the LCD Clock demo.
How do you think to deal with this and can I help to do something ?
Regards,
Xavier
Reply
02-01-2014, 10:50 AM,
#13
RE: Wanted : developers (alive)
Hi Xavier,
Thanks for this report.
I see no error in p8/pinguino/core/interrupt.c#OnTimer0() or p8/pinguino/core/interrupt.h
and when I try this code on a 47J53A, it seems to work at the right frequency :

Code:
void myBlink()
{
    toggle(USERLED);
}

void setup()
{
    pinMode(USERLED, OUTPUT);
    OnTimer0(myBlink, INT_MILLISEC, 1000);
}

void loop()
{
}

I think the bug is in the lcdlib.c library but please try this example first and tell me if it also works for you.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
02-01-2014, 05:22 PM, (This post was last modified: 02-01-2014, 11:14 PM by xapon66.)
#14
RE: Wanted : developers (alive)
Hello Regis,
The problem still remains.
Il try your example and mine with exact speed correction and flashing user Led.
Code:
/*    ----------------------------------------------------------------------------
    Simple LCD Clock demo whit USERLED Toggle every second
    original by <rblanchot@gmail.com>
  modified by <X. philippon aka xapon66>
    ----------------------------------------------------------------------------
    ---------- LCD 4x20
    ----------------------------------------------------------------------------
    01 - VSS (GND)
    02 - VDD (+5V)
    03 - Vo (R = 1K Ohm to GND)
    04 - RS (pin 8 in this ex.)
    05 - RW (GND = LOW = write mode)
    06 - EN (pin 9 in this ex.)
    07 a 10 - D0 a D3   (connected to GND in this ex.)
    11 a 14 - D4 to D7  (pin 0 to 3 in this ex.)
    15 - LED+ (R = 470 Ohm to +5V)
    16 - LED- (GND)
    ---------------------------------------------------------------------------*/

// Global vars

u8 s  = 0;
u8 m  = 0;
u8 h = 0;

// This function is called every sec. by timer 0

void tick()
{
    toggle(USERLED);
    if (s < 59)
    {
        s++;
    }
    else
    {
        s = 0;
        if (m < 59)
        {
            m++;
        }
        else
        {
            m = 0;
            if (h < 23)
            {
                h++;
            }
            else
            {
                h = 0;
            }
        }
    }    
    lcd.setCursor(4, 1);
    lcd.printf("%02u:%02u:%02u", h, m, s);
}

void setup()
{
  pinMode(USERLED, OUTPUT);
    // 4 bits mode, last four pins are not used
  lcd.pins(1, 2, 4, 5, 6, 7, 0, 0, 0, 0); // RS, E, D4 ~ D8    

    // LCD format
    lcd.begin(4, 0); // lines, dotsize

    lcd.home(); // 0, 0
    lcd.printf("Simple Clock Demo");
  lcd.setCursor(4, 2);
  lcd.printf("HH:MM:SS");
  delay(1000);
    
    // Timer0 call function tick() every sec.
    OnTimer0(tick, INT_MILLISEC, 5832);

}

void loop()
{
}

Now, I'll try the same program under Win7.
=> same result !!?
Reply
02-01-2014, 06:00 PM,
#15
RE: Wanted : developers (alive)
BTW, you can also use the RTCC library with both your Pinguino 47J53 and your Pinguino PIC32-OTG. Try RealTimeClock.pde in examples/09.Interfacing/RTCC.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
02-01-2014, 11:21 PM, (This post was last modified: 03-01-2014, 12:13 AM by xapon66.)
#16
RE: Wanted : developers (alive)
(02-01-2014, 06:00 PM)regis Wrote: BTW, you can also use the RTCC library with both your Pinguino 47J53 and your Pinguino PIC32-OTG. Try RealTimeClock.pde in examples/09.Interfacing/RTCC.
Thank you Régis,
I will try RTCC functions.
nevertheless, I think I've probably found a part of the solution.
getCpuFrequency returns 8 000 000 Hz instead of 48 MHz
getPeripheralFrequency returns 2 000 000 Hz instead of 12 MHz
The problem come from oscillator.c, OSCTUNEbits.PLLEN is always saw at false in System_getCpuFrequency function.
.....
I've just found a solution : OSCTUNEbits.PLLEN = 1 at the begining of setup.Smile
Reply
03-01-2014, 11:34 AM,
#17
RE: Wanted : developers (alive)
(02-01-2014, 11:21 PM)xapon66 Wrote: The problem come from oscillator.c, OSCTUNEbits.PLLEN is always saw at false in System_getCpuFrequency function.
.....
I've just found a solution : OSCTUNEbits.PLLEN = 1 at the begining of setup.Smile

The PLLEN bit is set by the bootloader and was set again by the user program in main.c so I commented the concerned line in main.c. I will come back to the previous version.
Try with this new main.c and tell me ...


.c   main.c (Size: 11.3 KB / Downloads: 3)
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
03-01-2014, 03:23 PM,
#18
RE: Wanted : developers (alive)
(03-01-2014, 11:34 AM)regis Wrote: The PLLEN bit is set by the bootloader and was set again by the user program in main.c so I commented the concerned line in main.c. I will come back to the previous version.
Try with this new main.c and tell me ...
Yes but after a reset OSCTUNE is cleared.
Reply
03-01-2014, 03:30 PM,
#19
RE: Wanted : developers (alive)
(03-01-2014, 03:23 PM)xapon66 Wrote:
(03-01-2014, 11:34 AM)regis Wrote: The PLLEN bit is set by the bootloader and was set again by the user program in main.c so I commented the concerned line in main.c. I will come back to the previous version.
Try with this new main.c and tell me ...
Yes but after a reset OSCTUNE is cleared.

True, but bootloader does it again on every restart. Bootloader sets up the system and then if bootloader mode buttons are not pressed jumps to user application. If user application does not change any parameters, parameters from bootloader are still active after user application starts.
Dreaming in Code...
Reply
03-01-2014, 04:19 PM, (This post was last modified: 03-01-2014, 04:20 PM by pingotg.)
#20
RE: Wanted : developers (alive)
I suppose it depends how much setup the bootloader does before checking the user button and jumping.

Ideally there'd be a spec saying (for 32-bit & 8-bit) what it does / does not do.

John
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)