Advertisement

Quick Links

Pololu P-Star User's Guide
Pololu P-Star User's Guide
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Supported operating systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Contacting Pololu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. P-Star 25K50 Micro pinout and components . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2. P-Star 25K50 Micro schematic and dimensions . . . . . . . . . . . . . . . . . . . . . . . 8
4. P-Star 45K50 Mini SV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1. P-Star 45K50 Mini SV pinout and components . . . . . . . . . . . . . . . . . . . . . . 11
5. Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1. Installing p-load and drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.2. Getting into bootloader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6. The P-Star Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.1. Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.2. Startup procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.3. Bootloader I/O pin usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.4. Bootloader LED behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.5. Configuration bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7. Programming using the PICkit 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9. Compiling a USB application with M-Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
10. Compiling a program with MPLAB X and MPASM . . . . . . . . . . . . . . . . . . . . . . . 39
11. Compiling a program with PICBASIC PRO . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
https://www.pololu.com/docs/0J62/all
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
© 2001-2019 Pololu Corporation
. . . . . . . . . . . . . . . . . . . . 15
. . . . . . . . . . . . . . . . . . . . . . 19
Page 1 of 46

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the P-Star Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Pololu P-Star Series

  • Page 1: Table Of Contents

    2. Contacting Pololu ........
  • Page 2: Overview

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 1. Overview The Pololu P-Star microcontroller boards are a family of general-purpose programmable modules based on the PIC18F25K50 and PIC18F45K50 microcontrollers from Microchip, which have 32 KB of flash program memory, 2 KB of RAM, and built-in full-speed USB functionality.
  • Page 3: Supported Operating Systems

    2 Without included optional headers. 1.1. Supported operating systems The Pololu USB Bootloader Utility (p-load), which is used to load programs onto the P-Star, works on Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10, Linux, and macOS. The utility does not work on Windows XP.
  • Page 4: Contacting Pololu

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 2. Contacting Pololu We would be delighted to hear from you about any of your projects and about your experience with the P-Star. You can contact us directly or post on our [https://www.pololu.com/contact]...
  • Page 5: P-Star 25K50 Micro

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 3. P-Star 25K50 Micro P-Star 25K50 Micro, top view. 3.1. P-Star 25K50 Micro pinout and components P-Star 25K50 Micro pinout diagram. This diagram identifies the I/O and power pins on the P-Star 25K50 Micro. The diagram is also...
  • Page 6 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation LEDs The P-Star 25K50 Micro has three indicator LEDs. These LEDs are connected in the same way on all P-Stars. yellow LED is connected to RB6. Driving this pin high turns on the LED. In bootloader mode, the...
  • Page 7 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation supply (such as a battery or wall power adapter) to the VIN and GND pins, with the positive terminal connected to VIN. VDD: This pin provides access to the board’s 5 V supply, which comes from either the USB 5 V bus voltage or a low-dropout (LDO) regulator on VIN, depending on which power source is connected.
  • Page 8: P-Star 25K50 Micro Schematic And Dimensions

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation Included hardware Two 1×10-pin breakaway 0.1″ male headers and one 1×6-pin [https://www.pololu.com/product/965] breakaway 0.1″ male header are included with the P-Star 25K50 Micro. These header pins can be soldered in to use the board with perfboards, breadboards [https://www.pololu.com/category/28/solderless-...
  • Page 9 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation P-Star 25K50 Micro schematic diagram. This schematic is also available as a PDF: P-Star 25K50 Micro schematic diagram 3. P-Star 25K50 Micro Page 9 of 46...
  • Page 10 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation (414k pdf). [https://www.pololu.com/file/0J797/p-star-25K50-micro-schematic.pdf] Dimension diagram A dimension diagram is available as a PDF: P-Star 25K50 Micro dimension diagram (202k pdf) [https://www.pololu.com/file/0J798/p-star-25K50-micro-dimensions.pdf] 3. P-Star 25K50 Micro Page 10 of 46...
  • Page 11: P-Star 45K50 Mini Sv

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 4. P-Star 45K50 Mini SV P-Star 45K50 Mini SV, bottom view. 4.1. P-Star 45K50 Mini SV pinout and components P-Star 45K50 Mini SV pinout diagram. 4. P-Star 45K50 Mini SV Page 11 of 46...
  • Page 12 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation This diagram identifies the I/O and power pins on the P-Star 45K50 Mini. The diagram is also available as a printable PDF (547k pdf). [https://www.pololu.com/file/0J1384/p-star_45k50_mini_sv_pinout.pdf] For more information about the PIC18F45K50 microcontroller and its peripherals, see Microchip’s PIC18F45K50 documentation [http://www.microchip.com/PIC18F45K50]...
  • Page 13 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation The board’s power selection circuit uses the TPS2113A power multiplexer [https://www.pololu.com/ from Texas Instruments to choose whether its 5 V supply is sourced from USB or an product/2596] external supply via the regulator, allowing both sources to be connected at the same time and enabling the P-Star to safely and seamlessly transition between them.
  • Page 14 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation P-Star 45K50 Mini SV dimensions, with P-Star 45K50 Mini SV, top view. U.S. quarter for size reference. USB power sensing The voltage from USB (VBUS) powers a voltage divider that produces a voltage called VBUSLEV that is 91% of VBUS.
  • Page 15: P-Star 45K50 Mini Sv Schematic And Dimensions

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation soldered in to use the board with perfboards, breadboards [https://www.pololu.com/category/28/solderless- , or 0.1″ female connectors breadboards] [https://www.pololu.com/category/50/0.1-2.54-mm-female-headers] P-Star 45K50 Mini SV on a breadboard, P-Star 45K50 Mini SV with included shown with a vertical 5-pin ICSP optional headers.
  • Page 16: Getting Started

    5. Getting started 5.1. Installing p-load and drivers To use the P-Star’s USB bootloader, you will need to install a command-line utility called the Pololu USB Bootloader Utility. This program is also known as “p-load” because that is the command used to run it from a command prompt.
  • Page 17: Getting Into Bootloader Mode

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation Source code Pololu USB Bootloader Utility source code is also available, so [https://github.com/pololu/p-load] you can build the utility yourself. 5.2. Getting into bootloader mode The P-Star comes with a USB bootloader that allows you to load new programs onto the P-Star over USB without using an external programmer.
  • Page 18 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation P-Star 25K50 Micro on a breadboard with a reset button (left) and a bootloader button (on-board). The bootloader button can be used for other purposes while your application is running. However, be careful to never drive the RB6 line low, or else pressing the button could cause a short circuit.
  • Page 19: Compiling A Program With Mplab X And Xc8

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation by the computer. 5.3. Compiling a program with MPLAB X and XC8 The P-Star can be programmed using standard development tools from Microchip. This section explains how to get started programming the P-Star in the C language using MPLAB X and XC8.
  • Page 20 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 6. On the “Select Tool” screen, you can select “PICkit 3” but this choice does not matter because we will not use MPLAB X to the load the program onto the board.
  • Page 21 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 9. We need to configure the project’s linker setting to properly account for the P-Star’s bootloader, which takes up the first 8 KB of flash memory. In the “File” menu, select “Project Properties”.
  • Page 22 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 10. Now we need to create the C source file. Locate the “Projects” pane. If the “Projects” pane is not visible, you can open it by opening the “Window” menu and selecting “Projects”. Left-click the “+”...
  • Page 23 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 11. Choose a file name like “main” and then click Finish.This should create a new file named “main.c” and open it for editing. 12. Copy and paste the following code into main.c: 5.
  • Page 24 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation #include <xc.h> #define _XTAL_FREQ 48000000 #define LED_GREEN(v) { TRISB7 = !(v); } #define LED_YELLOW(v) { TRISB6 = !(v); } #define LED_RED(v) { TRISC6 = !(v); } void main() // Set up the LEDs LATB7 = 1;...
  • Page 25: Programming Using P-Load

    EEPROM memories with the values specified in the HEX file, and then restart the device so that the application can run. The Pololu USB Bootloader Utility has many other options available, and you can see them by running with no arguments.
  • Page 26: The P-Star Bootloader

    © 2001–2019 Pololu Corporation 6. The P-Star Bootloader The P-Star comes with a proprietary bootloader developed by Pololu that uses a native USB protocol. The bootloader allows you to read and write the flash and EEPROM memories of the chip without using an external programmer.
  • Page 27: Startup Procedure

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation time to detect that the application has disconnected. The code below is PIC assembly code that shows how these vectors are defined in the bootloader. The two CPU interrupt vectors (0x0008 and 0x0018) each have a...
  • Page 28: Bootloader I/O Pin Usage

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation Going through this startup procedure is the only way that the application can run. The startup logic for the P-Star USB bootloader. 6.3. Bootloader I/O pin usage The bootloader uses the following I/O pins of the microcontroller: •...
  • Page 29: Configuration Bits

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation If an active USB connection is present, the green LED will blink to indicate whether the device has reached the USB Configured state. If the device has not reached the Configured state, the green LED will blink on and off with a 50% duty cycle and a period of about 1.4 seconds.
  • Page 30 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation // CONFIG1L #pragma config PLLSEL = PLL3X #pragma config CFGPLLEN = ON #pragma config CPUDIV = NOCLKDIV #pragma config LS48MHZ = SYS48X8 // CONFIG1H #pragma config FOSC = HSH #pragma config PCLKEN = OFF...
  • Page 31 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation #pragma config EBTRB = OFF Full documentation of these settings can be found in the PIC18F25K50/PIC18F45K50 datasheet, and some of the settings are discussed below. Instruction set The PIC18 extended instruction set is disabled, so the microcontroller uses the legacy instruction set.
  • Page 32 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation to continue operating if VDD falls below 2.85 V. However, it will not be able to power up successfully from a voltage below 2.85 V, because SBOREN is set to 1 on power-up. Also, the microcontroller is not guaranteed to operate correctly below 2.7 V without switching to a slower clock source.
  • Page 33: Programming Using The Pickit 3

    Warning: Using a PICkit to program the P-Star will permanently erase its USB bootloader, so you will not be able to program it over USB using the Pololu USB Bootloader Utility. It will also erase the serial number of the device.
  • Page 34 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation The P-Star 25K50 Micro connected to a PICkit 3 programmer and a reset button. Another option for connecting a P-Star to a PICkit is to solder upwards-pointing header pins on all five programming pins, as shown below. The PICkit 3 can then be directly connected to this...
  • Page 35 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation The P-Star 25K50 Micro with a vertical P-Star 45K50 Mini SV on a breadboard, 5-pin programming header installed. shown with a vertical 5-pin ICSP programming header installed. 7. Programming using the PICkit 3...
  • Page 36: Compiling P-Star Examples

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 8. Compiling P-Star examples P-Star Examples repository contains several example [https://github.com/pololu/p-star-examples] programs for the P-Star that show how to use the USB interface and other parts of the P-Star. The file in the repository has instructions for building the examples with the MPLAB Xpress README.md...
  • Page 37: Compiling A Usb Application With M-Stack

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 9. Compiling a USB application with M-Stack The examples in Section 8 show how to use the Microchip USB stack on the P-Star. M- Stack is an alternative USB stack for PICs that we have modified to work on the P-Star.
  • Page 38 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 10. Use p-load to load this HEX file onto the P-Star using its USB bootloader, as described in Section 5.4. 11. If the app runs successfully, it should connect to the computer as a standard USB mouse and you should see your mouse cursor moving back and forth horizontally.
  • Page 39: Compiling A Program With Mplab X And Mpasm

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 10. Compiling a program with MPLAB X and MPASM This section explains how to get started programming the P-Star in assembly using MPLAB X and XC8. MPLAB X a free integrated development (IDE) from Microchip [http://www.microchip.com/mplabx]...
  • Page 40 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 5. For the Device, type the name of the microcontroller on your P-Star, which is either “PIC18F25K50” or “PIC18F45K50”. Click “Next”. 6. On the “Select Tool” screen, you can select “PICkit 3” but this choice does not matter because we will not use MPLAB X to the load the program onto the board.
  • Page 41 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 9. In the “File” menu, select “Project Properties”. In the “MPASM (global options)” category, check the “Build in absolute mode” check box, then click “OK”. 10. Now we need to create the assembly source file. Locate the “Projects” pane. If the “Projects”...
  • Page 42 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation pane is not visible, you can open it by opening the “Window” menu and selecting “Projects”. Left-click the “+” sign next to “Source Files” to expand it and verify that your project has no source files yet.
  • Page 43 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation #include <p18f25k50.inc> 0x2000 goto start 0x2020 ledRedOn: TRISC, 6 return ledRedOff: TRISC, 6 return start: LATC, 6 ; Set up the red LED ; Enable Timer 0 as a 16-bit timer with 1:256 prescaler: ;...
  • Page 44 Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation For information about MPASM, see its user’s guide, which is in the “mpasmx/docs” directory inside your MPLAB X installation. If you have questions, you can post in Microchip’s MPASM forum [http://www.microchip.com/forums/ or the Pololu Robotics Forum f16.aspx]...
  • Page 45: Compiling A Program With Picbasic Pro

    Pololu P-Star User’s Guide © 2001–2019 Pololu Corporation 11. Compiling a program with PICBASIC PRO The P-Star is compatible with PICBASIC PRO, a BASIC language compiler from microEngineering Labs that runs on Microsoft Windows and targets PIC microcontrollers. This section explains how to compile a program and load it onto the P-Star using MicroCode Studio, the IDE that comes with PICBASIC PRO.
  • Page 46 After the compilation succeeds, you will have a valid HEX file and you could load it onto the P-Star using the Pololu USB Bootloader Utility (p-load) from the command line. However, we recommend following the instructions below which explain how to integrate p-load with MicroCode Studio so you can load your program onto the P-Star without leaving the IDE.

This manual is also suitable for:

P-star 25k50 microP-star 45k50 mini sv

Table of Contents