Basics/hu

From Pinguino
Jump to: navigation, search
Language: English  • español • magyar • русский


Bootloader - Letöltő

A letöltő egy kicsi program ami a Pinguinodra már előre be van égetve (PIC18F és PIC32MX). Ez a program felel az átvitelről a számítógéped és a Pinguino Board között. Képes az általad írt programot beégetni a Pinguino mikrovezérlőjébe egyszerűen, közvetlenül az IDE-ből.

A letöltő minden esetben előre van telepítve minden kereskedelemben kapható Bord-ba.

Ha saját magad szeretnél készíteni egy Board-ot akkor ezt a letöltőt be kell programozni a PIC kontrollerbe (csak egyszer) egy éltalénos PIC programozóval.

8-bites Pinguino

Jelenleg 4 letöltő érhető el de csak 2 igazán támogatott )elérhető innen):

  • Version 1 ami csak a 18F2550 alapú Boardok-at támogatja (kb. 7K);
  • Version 2 ami használható mind a 18F2550 és a 18F4550 alapú Pinguino Board-okon (kb. 7K).
  • Version 3 ennek az alapja ez a Diolan féle letöltő és Assembler nyelven íródott (kb. 1.5K). Sajnos nem műkodik együtt az SDCC-vel (ez az alap fordító) ami nem támogatja a PIC18F Kiterjesztett utasítás készletét. Azonban tökéletesen működik MPLAB X alatt.
  • Version 4 ez SDCC-vel lett fordítva (>3.0.0), kevesebb, mint 3k és elérhető PIC18F 1xK50 (nem tesztelt), x455, x550, x6J50, x6j53 és x7j53 alapú Pinguino Board-okhoz, belső és külső oszcillátorral, valamint alacsony (Pinguino IDE nem támogatja) vagy nagy sebességű USB kapcsolattal.

Ha Version 1 üet használod, akkor a Board-nak tartalmaznia kell a RUN kapcsolót, különben semmi sem fog történni (RUN kapcsoló hatérozza meg, hogy a te programod, vagy a letöltő fusson)

Ha a 2,3 vagy 4-es verziüt használod, ez a RUN kapcsoló nem szükséges mert a letöltő automatikusan határozza meg az üzemmódot (RESET utén) ami az 2-es verziónál 5 másodperc, a 3-as és 4-es (4.13-ig) verzióknál 10.

4.13 és újabb verzióknál nincs idő korlátozás ha a REST gomb meg lett nyomva. A felhasználó programja automatikusan elindul a letöltés végeztével.

32-bites letöltők

Az összes 32-bites letöltő itt található.

Programod letöltése

Mindent a Pinguino IDE vezérel.

Írd meg a programod és függetlenül a letöltőd verziójától, fordítsd le.

8-bit Pinguino Boardüok

Attól függ, hogy melyik Board-ot használod és melyik letöltőt. Depending on your Pinguino design, there are several bootloader versions.

In version 1 (see above) of the bootloader:

Push the reset button on your Pinguino board. The run led should remain dark. If it is lit, you have probably short circuited the run button with a jumper.

Click on the upload button and wait for the VascoBootloader to appear. Click the 'write' button in VascoBootLoader.

You should get something like PIC found followed by XXX.hex uploaded, XXX being the filename of your user program.

Now push the run button to start your program.


When using version 2 (see above) things get a little easier.

First press the reset button on the Pinguino Board. Then wait 3 seconds and click the upload button in the Pinguino IDE. The built-in led should stay on solid.

You should get something like Pinguino found followed by XXX.hex uploaded, XXX being the filename of your user program.

If you get 'Pinguino not found !!' you have not waited long enough, just click 'write' again.

If you get 'Pinguino found' followed by nothing you waited too long. In this case Reset your Pinguino board, wait 3 seconds and try again.


Using version 3 (see above).

First press the reset button on your Pinguino board. The built-in led should stay on solid. You now have 5 seconds to upload your program.

Second, click the upload button in the Pinguino IDE.

That's it !

You should get something like :

Pinguino found ...
- with PIC18f26j50 (id=0x4c40)
- with USB bootloader v4.x
Writing User Application ...
xxxxxxx.hex successfully uploaded
Starting Application ...

If you get:

Pinguino not found
Is your device connected and/or in bootloader mode ?

you may have not connected your board or you may have waited too long after pressing the reset button before uploading your program. Try again from the beginning.


Using version 4 up to v4.11 (see above)

First press the reset button on your Pinguino board.

  • If you connect a USB cable between your PC and your Pinguino board, the bootloader waits 10 seconds for a program to be uploaded during which time the red LED blinks every half-second.
  • If the board is powered with an external power supply and the USB to PC cable is not connected, the bootloader waits about 5 seconds during which time the red LED stays lit.

Second, click the upload button in the Pinguino IDE.

That's it !

You should get something like :

Pinguino found ...
- with PIC18f26j50 (id=0x4c40)
- with USB bootloader v4.x
Writing User Application ...
xxxxxxx.hex successfully uploaded
Starting Application ...

If you get:

 Pinguino not found
 Is your device connected and/or in bootloader mode ?

you may have not connected your board via USB to your computer or you may have waited too long after pressing the reset button before uploading your program. Try again from the beginning.


Using version 4.12 and above

Versions 4.12 and above behave now differently from previous versions:

  • The user application starts without any delay on Power-on Reset
  • The bootloader starts only if Reset button has been pressed
  • The bootloader mode stays on until a program has been uploaded (no more time limit)
  • The led blinks at high frequency (T=2*43ms)

First press the reset button on your Pinguino board.

Second, click the upload button in the Pinguino IDE.

No hurry, take your time, the bootloader will wait until you press the upload button in the IDE.

That's it !

On a Pinguino 26j50, you should get something like :

Pinguino found ...
- with PIC18f26j50 (id=0x4c40)
- with 62464 bytes free (61 KB)
- with USB bootloader v4.xx
Uploading user program ...
xxxxx bytes written.
xxxxx.hex successfully uploaded
Starting user program ...

On a Pinguino 47j53, you should get something like:

Pinguino found ...
- with PIC18f47j53 (id=0x58e0)
- with 128000 bytes free (125 KB)
- with USB bootloader v4.xx
Uploading user program ...
xxxxx bytes written.
xxxxx.hex successfully uploaded
Starting user program ...

If you get :

Pinguino not found
Is your device connected and/or in bootloader mode ?

you may not have connected your board via USB to your computer or not pressed the reset button.

on 32-bit Pinguino

Before telling the Pinguino IDE to upload your program you need to connect your board and put it in bootloader mode:

   Press and hold down the user button BUT
   Press and release the user button RST (Reset)
   Release the user button BUT 

You should now see the two built-in LEDs (yellow and green) flashing alternately. Now you and your Pinguino are ready to upload your program.

Once the upload is complete, the two LEDs will stop flashing and the program will start automatically.

To exit the bootloader mode without uploading a new program:-

   Press and release the user button RST (Reset) 

The two LEDs will stop flashing and the previously installed program will start running again.

Hello World

Step 1

  • Windows

Prepare the connection to the Pinguino device by installing the driver from: http://linux.gatewaybbs.com.au/~zapper/EFIlive/USB%20Cable%20driver/

When you connect the device , a Found New Hardware balloon -- Device named Pinguino appears

The driver for the PIC18F4550 device is in the Pinguino IDE Folder

..\PINGUINO\x4-easy-rev959\extra\drivers\CDC

You will have a COMx connection when you plug the usb cable to the computer.

  • Linux

Nothing to do.

  • OS X

Does not work with CDC functions at this time (November 2013).

Step 2: Write the following in the Pinguino IDE

 void setup()
 {
   // put your setup code here, to run once:
 }

 void loop()
 {
   // put your main code here, to run repeatedly: 
   CDC.println("\n\r Hello World!!!");
 }

Step 3: Compile and upload the code (see above)

Step 4: Select Menu->Pinguino->Debug Mode->USB CDC And on the bottom section the port x on which the device is connected and there you go:

Hello World!!!

alternative:

  • Windows

You also can use an other terminal or console such as putty to view the output. The settings are:

    • Port: it depents. Normally it will be COM7. You can guess or you can check it. In Windows you can do this by right clicking on "my computer" -> manage -> device manager -> ports -> there should be a "communications port (COMx)". The x is the number of your COM port. If there is none but you have a yellow question mark in the device manager, you possible need to install the CDC driver. First download: http://ww1.microchip.com/downloads/en/AppNotes/CDC_RS232_Emulation.EXE. After you installed the package, go in the device manager to the yellow question mark, right click it and choose to manage or install the driver and point to the installed folder. (standard: C:\MCHPFSUSB\fw\Cdc\inf\win2k_winxp). This will install the driver. If it does not work, the question mark could be from an other device that needs your attention. The driver from the link normally will work from Windows 2000 till Windows 8 X64.
    • Speed (Baud): 115200
    • Data bits: 8
    • Stop bits: 1
    • Parity: None
    • Flow control: XON/XOFF
    • That's it
  • Linux

You can use a Terminal Emulation Program such as Minicom :

sudo minicom -o -D /dev/ttyACM0

Writing programs

Init function

TODO

void setup()
{
        pinMode(0,OUTPUT);
}


Main function

TODO

void loop(void)
{
        digitalWrite(0,HIGH);
        delay(500);
        digitalWrite(0,LOW);
        delay(500);
}

Interrupt function

TODO

void interrupt()
{
	// timer 1 interrupt flag in register PIR1
	if (PIR1bits.TMR1IF)
	{
		// reset interrupt flag
		PIR1bits.TMR1IF=0;
		// reverse state of pin 0 ( blink )
		digitalWrite(0,digitalRead(0)^1);
	}
}

If an interrupt service routine changes variables which are accessed by other functions these variables have to be declared volatile. See Wikipedia (From the SDCC Documentation).