Search in Pinguino World !!

Sunday, December 25, 2011

How to use interrupt on Pinguino32

Pinguino32 doesn’t support interrupt routines without writing a code in an assembler file. We decided to open interrupt to everybody. To do this, we used some of the special attribute directive of GCC. Now you can deal with Interrupt without assembler.

This example show how to use the Timer 1 to increment a counter.

// Using interrupt with Pinguino32
// Jean-Pierre MANDON 2011

#include

unsigned int counter=0;

void ISR_wrapper_vector_4(void) __attribute__ ((section (".vector_4")));
// Put the ISR_wrapper in the good place

void ISR_wrapper_vector_4(void) { Tmr1Interrupt(); }
// ISR_wrapper will call the Tmr1Interrupt()

void Tmr1Interrupt(void) __attribute__ ((interrupt));
// Tmr1Interrupt is declared as an interrupt routine

// define here the code to execute when an interrupt occure
void Tmr1Interrupt(void)
{
if (IFS0bits.T1IF) // Timer Interrupt flag
{
TMR1=0; // reset the timer register
IFS0CLR=0x10; // Clear the timer interrupt flag
counter++; // increment the counter
}
}

// configure timer 1
void init_timer1(void)
{
IntConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); // interrupt mode (interrupt.c)
T1CON=0; // reset timer 1 configuration
TMR1=0; // reset timer 1 counter register
PR1=0x9999; // define the preload register
IPC1SET=0x7; // select interrupt priority and sub-priority
IFS0CLR=0x10; // clear interrupt flag
IEC0SET=0x10; // enable timer 1 interrupt
T1CONSET=0x8010; // start timer 1 and set prescaler
}

void setup()
{
init_timer1();
}

void loop()
{
CDC.printf("%d\n\r",counter); // counter is incremented at each timer 1 overflow
delay(1);
}

Be careful, some interruption are already used by Pinguino32. Vector_8 (timer 2) is used by the function millis(). vector_24 (Serial1 interrupt) and vector_32 (Serial2 interrupt) are used by the serial module. vector_35 ( RTCC ) is used by the real time clock module.
All the test have been made with a PIC32-PINGUINO-OTG board and Linux IDE.

Sunday, December 4, 2011

KIDULES

Arduino’s idea is to hide the processor and complex C features, working with pins and libraries. Pinguino do the same, but it is also a powerful pedagogical tool to learn embedded systems and C. The Kidules follow this objective, and associate to the learning steps dedicated hardware that allows to concentrate on the software. Once the C and hardware features of the processor are mastered, any application with any C compiler can be envisioned, part of the application being initially tested on the Kidules.

The Ki18F2550 board features two 8-bit ports on which application and test circuits are connected. Each slave module has a simple and clear functionality:
- the Dice with 7 leds and a push-button helps with the understanding of bits and bytes. Using tables and byte access replace the writing of pages of digitalWrite (..); instructions.
- the Traffic light is good to think about specifications, before its easy programming.
- the Elevator has a motor and 3 sensors. It prepares for robots and exercises the notion of state machines
- the Clock helps understanding stepping motors. I2C clock circuit is an option.
Other Kidules allows to understand motors, sensors, internal PIC registers and their configuration. See www.didel.com/kidules/
The Kidules are specially suited for the first part of a Robotic or Embedded system lab.
The KiCar (not shown) is similar to the Ki2550, with ports for motors and sensors, ready to control a robot avoiding obstacles.
Documentation is mostly in French now. Ask to be updated : info@didel.com .

Friday, November 11, 2011

Increase speed on Pinguino32 !!

Default peripheral speed on Pinguino is programmed to 10 Mhz. For some application, we need to increase this speed ( 10 MIPS is less than a Pinguino 8 bits ). To achieve this, we must use the system library which is located in the /p32/include/pinguino/basics folder ).
The peripheral speed is derived from the system clock speed wich is 80 MHZ on Pinguino 32. You can select a peripheral speed with the SetPeripheralClock(divider) function. Divider should be chosen in the predefined value.
PBDIV8 use a 10 Mhz peripheral speed ( default value in Pinguino ).
PBDIV4 -> 20 Mhz
PBDIV2 -> 40 Mhz
PBDIV1 -> 80 Mhz

As an example, we propose this small program:

// increasing peripheral speed on Pinguino32
// Jean-Pierre Mandon 2011

void setup()
{
SetPeripheralClock(PBDIV1);
Serial.begin(9600);
}

void loop()
{
Serial.printf("System clock=%d\n\r",GetSystemClock());
Serial.printf("Peripheral clock=%d\n\r",GetPeripheralClock());
delay(500);
}

SetPeripheralClock must be the first instruction in the setup() because peripheral speed is used to configure Serial, delay and SPI.

Now your Pinguino32 is a real 32 bits/80 MIPS computer !!

Saturday, October 1, 2011

Open Silicium

Pinguino is described in the last issue of Open Silicium. This French paper speak about Open Hardware and Open Software.

Saturday, September 17, 2011

PinguBot

Pingubot is a small robot based on Pinguino 8 bits. Furri and Bastian designed this board to teach how to drive a robot with Pinguino.


The first PinguBot workshop will take place in the OSHWcon event in Madrid. Unfortunately, there is only 16 participant and registering is already closed.
We hope we will have soon another workshop somewhere in Spain.


Congratulations for this great initiative.

More info:
Pingubot website
OSHWcon website
Furri website

Tuesday, September 6, 2011

USB Female/Female A Adaptor


As usual, in the middle of the night, I was playing with my Android phone and Pinguino32. To connect them together, I was searching a USB female/female type A connector everywhere in my office. Finally I made this adaptor with a recycled connector found on an old mother board !!
The pin are soldered together on the bottom of the connector.

Saturday, September 3, 2011

Fractal with Pinguino

Marcus is one of the developers of Pinguino IDE. He focused on LCD and GLCD libraries.
He developed this example to show how to compute and display Fractal with Pinguino.



This is an example of a Mandelbrot set.
More info on Marcus's website.

Wednesday, August 31, 2011

Pinguino Robot !!

Julio is a teacher and he uses Pinguino to develop real robot with students.
This one is the last robot they built with recycled parts.



Congratulations to Julio and all the students working on this project.

Visit Julio's blog, it's a great source of information for Pinguino and electronic.

Friday, August 19, 2011

Pinguino Data logger

I discovered this great video today !! This Pinguino data logger built with a 8 bits Pinguino and Gambas is really nice....



Congratulations !!

Wednesday, August 17, 2011

Pinguino 32 with Android.

First test of Pinguino32 with Android is done. We incorporated in Pinguino32X the IOIO ADB library and everything is working fine. My son, Thomas presents here my first Android/Pinguino application ( as usual I drive Led !! )



As most of Android devices are not yet upgraded with Android 2.3.4, we decided to use ADB protocol wich is compatible with Android 1.6 and higher. As usual in Pinguino IDE, you need only 3 instructions to establish a link with an Android device. We are currently working on the release of the Pinguino IDE. It will incorporate Zigbee, ADB and our current job is to incorporate USB Host to connect mouse, keyboard and generally all useful USB devices.

I am very proud of my first Andoid application, even is this one is not optimised as it should be !!


Many thanks to the IOIO project and Ytai Ben-Tsvi, his owner. Most of the job shown here couldn't be done without the IOIO code.