Hardware/PICEBS/Welcome

From UIT
(Difference between revisions)
Jump to: navigation, search
 
(30 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{TOC right}}
 
{{TOC right}}
 
== Welcome to the PICEBS2 wiki ==
 
== Welcome to the PICEBS2 wiki ==
If you don't know what the PICEBS2 project is, have a look a the [[#Presentation | presentation]].
 
 
== Presentation ==
 
 
<div id="presentation"></div>
 
<div id="presentation"></div>
  
PICEBS2 ([[Hardware/PICEBS/2|hardware details]]) is the name of a small embedded computer board targeted at teaching embedded system programming.
+
PICEBS2 ([[Hardware/PICEBS/2|hardware details]]) is the name of a small embedded computer board targeted at teaching embedded systems programming.
As it's name suggests, it's the second iteration of a successful family of Microchip PIC board, this time focused on a stronger system.
+
As its name suggests, it is the second iteration of a successful family of Microchip PIC board, this time with the objective to realize an all-in-one system (the debugger PICKIT3 is included on board).
  
 +
Please note that, as a student, you can '''loan a board for free''' during your studies to work at home ;-) Just ask the laboratory responsible [[User:sap|Pascal Sartoretti]] (sap) for the procedure to follow.
 
[[File:PICEBS2.jpg|400px|center]]
 
[[File:PICEBS2.jpg|400px|center]]
  
 
We, [[Hardware/PICEBS/2/Team |the PICEBS2 team]], provide a comprehensive solution for
 
We, [[Hardware/PICEBS/2/Team |the PICEBS2 team]], provide a comprehensive solution for
* Practical work for [http://hevs.ch HEI] courses ''Information systems''
+
* Practical work for [http://hevs.ch HEI] course [http://sin.begincoding.net ''Information systems''] given in second year.
* All kind of project featuring a low-sized micro-controller.
+
* All kind of project featuring a small-sized micro-controller.
  
  
=== What can be done with the PICEBS2 ? ===
+
=== What can be done with the PICEBS2? ===
 
The board is powerful enough to run applications with:
 
The board is powerful enough to run applications with:
 +
 
* LCD and touch screen interface
 
* LCD and touch screen interface
 
* Serial port usage (UART)
 
* Serial port usage (UART)
 
* CAN interface
 
* CAN interface
* FIXME complete this list
+
* ...
* This board includes the PICKIT3 for programming and debugging
+
 
 +
To program this board, you do not require an external programming probe, as it already includes a PICKIT3 system for programming and debugging. All you need is an USB port and the [http://www.microchip.com/pagehandler/en-us/family/mplabx/ free MPLAB-X] IDE.
  
 
=== Hardware ===
 
=== Hardware ===
 
([[Hardware/PICEBS/2|hardware details]]).  
 
([[Hardware/PICEBS/2|hardware details]]).  
  
Here is a list of the main PICEBS2's characteristics
+
Here is a list of the main PICEBS2's characteristics:
 +
 
 
* CPU PIC18F87K22
 
* CPU PIC18F87K22
 
** High range PIC18 family with 128kB Flash & 4kB RAM
 
** High range PIC18 family with 128kB Flash & 4kB RAM
Line 38: Line 39:
 
* Onboard PICKIT3 debugger
 
* Onboard PICKIT3 debugger
 
** Compatible with MPLABX
 
** Compatible with MPLABX
 +
** Can be used standalone or turned off
 
* LCD Display
 
* LCD Display
** 320x240
+
** 320x240, 265k colors
** Touch screen
+
** Backlight
 +
** Resistive touch screen
 
* Networking and communication
 
* Networking and communication
** CAN
+
** CAN bus
 
** RS232
 
** RS232
 
** PS2 keyboard
 
** PS2 keyboard
 
** Olimex UEXT
 
** Olimex UEXT
 +
* Development
 +
** All CPU pins are available on a connector
 +
** Standard HES-SO//Valais 26 pin header on board
  
 
=== Software ===
 
=== Software ===
  
 
* Source files for assembler laboratories
 
* Source files for assembler laboratories
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/conf_bits.asm Configuration bits for PICEBS2 in assembler]
+
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/conf_bits.inc Configuration bits for PICEBS2 in assembler]
 
* Source files for C laboratories  
 
* Source files for C laboratories  
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/configuration_bits.c Configuration bits for PICEBS2 in C]
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/configuration_bits.c Configuration bits for PICEBS2 in C]
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/ All libraries files in C]
+
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/can CAN libraries files]
 +
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/lcd LCD libraries files]
 +
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/keyboard Keyboard libraries files]
 
* Tools  
 
* Tools  
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/incbin.exe incbin.exe -> Transform any file in a 'C' table of characters (for bitmaps, ...)]
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/incbin.exe incbin.exe -> Transform any file in a 'C' table of characters (for bitmaps, ...)]
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/TheDotFactory.exe TheDotFactory.exe -> Transform any font on your PC in a 'C' table of characters for graphical use]
 
** [https://hevslabs:hevslabs@repos.hevs.ch/svn/picebs2-labs/trunk/TheDotFactory.exe TheDotFactory.exe -> Transform any font on your PC in a 'C' table of characters for graphical use]
* Tips  
+
 
 +
=== Tips & tricks ===
 +
* CPU speed control
 
<pre>
 
<pre>
// to work with maximum CPU speed (64MHz) insert following code at start.
+
// to work at maximum CPU speed (64MHz) insert following code at start.
 
   PLLEN = 1;            // activate PLL x4
 
   PLLEN = 1;            // activate PLL x4
 
   OSCCON = 0b01110000;  // for 64MHz cpu clock (default is 8MHz)
 
   OSCCON = 0b01110000;  // for 64MHz cpu clock (default is 8MHz)
 
+
// Caution -> the PLL needs up to 2 [ms] to start !
 +
// Wait a moment if needed with: __delay_ms(2);
 +
  ...
 
</pre>
 
</pre>
 +
* Change one bit on a port
 +
<pre>
 +
// to change one bit on a port, use LATx and not PORTx
 +
  LATH2 = 1;            // turn led on for example
 +
  ...
 +
</pre>
 +
* Interrupt on change on PORTB (RB4-RB7)
 +
<pre>
 +
// to clear the interrupt flag you have to read the PORTB
 +
  ...
 +
  PORTB;              // clear the latch change on PORTB
 +
  RBIF = 0;            // clear the interrupt itself
 +
  ...
 +
</pre>
 +
* Reduce current consumption
 +
<pre>
 +
// To reduce consumption at minimum, do at least
 +
  LCD_PowerOff();  // turn all LCD parts off
 +
  UART_PowerOff(); // turn UART driver off
 +
  Can_PowerOff();  // turn off MCP2515 chipset
 +
// And define unused GPIOs as output
 +
  TRISB5 = 0;      // for example
 +
  ...
 +
// You can measure (between white and yellow test points) about 630 uA after a SLEEP();
 +
</pre>
 +
* Link in low address range (download time reduced)
 +
<pre>
 +
  - To reduce the time to download, you need to write a linker special command
 +
      In the "XC8 linker" - "Extra Linker Option" write the following line:
 +
      "-L-ACODE=0x0-0x10000 -L-AMEDIUMCONST=0x0-0x10000"
 +
  - Another solution is to have an interrupt routine (even if nothing in)
 +
  The full program needs to be smaller than 50% of CPU Flash memory.
 +
</pre>
 +
 
== Bugs, issues, questions and comments ==
 
== Bugs, issues, questions and comments ==
Feel free to contact the [[Hardware/PICEBS/2/Team |PICEBS2 team]] when you encounter a problem. Don't forget to have a look at the [[Hardware/PICEBS/2/Troubleshooting|troubleshooting]] section ;)
+
Feel free to contact the [[Hardware/PICEBS/2/Team |PICEBS2 team]] if you encounter a problem. Do not forget to have a look at the [[#Tips & tricks| Tips & tricks]] section.

Latest revision as of 17:00, 1 February 2018

Contents

Welcome to the PICEBS2 wiki

PICEBS2 (hardware details) is the name of a small embedded computer board targeted at teaching embedded systems programming. As its name suggests, it is the second iteration of a successful family of Microchip PIC board, this time with the objective to realize an all-in-one system (the debugger PICKIT3 is included on board).

Please note that, as a student, you can loan a board for free during your studies to work at home ;-) Just ask the laboratory responsible Pascal Sartoretti (sap) for the procedure to follow.

PICEBS2.jpg

We, the PICEBS2 team, provide a comprehensive solution for

  • Practical work for HEI course Information systems given in second year.
  • All kind of project featuring a small-sized micro-controller.


What can be done with the PICEBS2?

The board is powerful enough to run applications with:

  • LCD and touch screen interface
  • Serial port usage (UART)
  • CAN interface
  • ...

To program this board, you do not require an external programming probe, as it already includes a PICKIT3 system for programming and debugging. All you need is an USB port and the free MPLAB-X IDE.

Hardware

(hardware details).

Here is a list of the main PICEBS2's characteristics:

  • CPU PIC18F87K22
    • High range PIC18 family with 128kB Flash & 4kB RAM
    • RTC
    • 12 bits ADC
    • 11 timers
    • UART, SPI, I2C
    • ...
  • Onboard PICKIT3 debugger
    • Compatible with MPLABX
    • Can be used standalone or turned off
  • LCD Display
    • 320x240, 265k colors
    • Backlight
    • Resistive touch screen
  • Networking and communication
    • CAN bus
    • RS232
    • PS2 keyboard
    • Olimex UEXT
  • Development
    • All CPU pins are available on a connector
    • Standard HES-SO//Valais 26 pin header on board

Software

Tips & tricks

  • CPU speed control
// to work at maximum CPU speed (64MHz) insert following code at start.
   PLLEN = 1;            // activate PLL x4
   OSCCON = 0b01110000;  // for 64MHz cpu clock (default is 8MHz)
// Caution -> the PLL needs up to 2 [ms] to start !
// Wait a moment if needed with: __delay_ms(2);
   ...
  • Change one bit on a port
// to change one bit on a port, use LATx and not PORTx
   LATH2 = 1;            // turn led on for example
   ...
  • Interrupt on change on PORTB (RB4-RB7)
// to clear the interrupt flag you have to read the PORTB
   ...
   PORTB;               // clear the latch change on PORTB
   RBIF = 0;            // clear the interrupt itself
   ...
  • Reduce current consumption
// To reduce consumption at minimum, do at least
   LCD_PowerOff();  // turn all LCD parts off
   UART_PowerOff(); // turn UART driver off
   Can_PowerOff();  // turn off MCP2515 chipset
// And define unused GPIOs as output
   TRISB5 = 0;      // for example
   ...
// You can measure (between white and yellow test points) about 630 uA after a SLEEP();
  • Link in low address range (download time reduced)
   - To reduce the time to download, you need to write a linker special command
      In the "XC8 linker" - "Extra Linker Option" write the following line:
      "-L-ACODE=0x0-0x10000 -L-AMEDIUMCONST=0x0-0x10000"
   - Another solution is to have an interrupt routine (even if nothing in)
   The full program needs to be smaller than 50% of CPU Flash memory.

Bugs, issues, questions and comments

Feel free to contact the PICEBS2 team if you encounter a problem. Do not forget to have a look at the Tips & tricks section.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox