II - Tutorial - Simple project on CubeSat Kit

The beginning with the CubeSat Kit can be complicated and time wasting, by going from documentation until a working implementation on electronic components, so the following tutorial is proposed in order to progress in a project structure step by step.

1. Inventory & Documentation

1.1 Equipment

See previous chapter I - Equipment

1.2 Five essential manuals to well begin

(1) CubeSatKit Manual.pdf
(2) CubeSat Kit SD Card and EFFS-THIN User Manual.pdf
(3) Salvo User Manual.pdf
(4) dsPIC33FJXXXGPX10 Manual.pdf
(5) Development Board Manual.pdf

1.3 From previous project : SPUTNIK STRIKES BACK

Equipments

1.4 From Pumpkin : Cubesat kit overview

Training material - read this first - Cubesat physical dimensions


2. Elementary steps

1 - Download latest release of MPLAB X IDE on the Website under Downloads e.g. for Windows (x86/x64) : MPLAB® X IDE v3.15
-> Integrated Development Environment to implement code and either simulate it on computer or load it on electronic components

2 - Download latest release of XC16 Compiler for MPLAB on the Website under Downloads e.g. for Windows (x86/x64) : MPLAB XC16 Compiler v1.25
-> C compiler for 16 bits PIC processors from Microchip
Notes : It can be installed to run in Free mode and take care to install x16\ under Microchip\ folder otherwise MPLAB won't recognize it

3 - On the same way, download under the same section at Peripheral Libraries 16-bit dsPIC33 Peripheral Libraries e.g. 16-bit dsPIC33, PIC24E, PIC24H MCUs: Legacy Peripheral Libraries
Note : Take care to install it under \Microchip\xc16\v1.25\ (if this version)
-> Essential libraries to program dsPIC33 such as <uart.h>, <timer.h> etc.

4 - Test of connectivity with ICD3
i- Manually Install Driver " Microchip\MPLAB X IDE\Switcher\64bit\winusb " for ICD3 - Tutorial here
ii- Test :

-> Ready to work with development board

5 - Download necessary files for CubeSat Kit on Cubesat Kit software for dsPIC33 microcontrollers from Pumpkin
-> Contains source files, libraries and examples for the dsPIC33 use in the CubeSat Kit

6 - Download necessary files for Salvo (dsPIC) on Salvo OS for dsPIC33 microcontrollers and EFFS Thin SD card support Pumpkin
-> Contains source files, libraries and examples for the use of the Real-Time Operating System (RTOS)

7 - Download Pumpkin's processor-specific software libraries 1.0.1 and 1.0.2


3. Creation of a simple MPLAB X IDE project

1- Settings :
i- Projects : Standalone Project
ii- Device Family : 16-bits DSCs (dsPIC33) Device : dsPIC33FJ256GP710
iii- Tool : ICD 3 >

iv- Compiler : XC16

2- How to add your dedicated files :
i- Right-click on Source Files > Add Existing Items From Folders... > Add Folder... > Select as Type of File : and chose your folder
ii- For Headers see 5. - Building
iii- Right-click on Libraries > Add Library/Object File > Choose one library (1 by 1)


4. File management

For C-Files : C:\Pumpkin\Salvo\Src

For H-Files : C:\Pumpkin\Salvo\Inc

For C-Files : C:\Pumpkin\CubeSatKit\DSPIC33\src

For H-Files : C:\Pumpkin\CubeSatKit\DSPIC33\inc

For Libraries : C:\Pumpkin\CubeSatKit\DSPIC33\lib\mcc30-v3

For peripheral libraries of dsPIC33F : C:\Program Files (x86)\Microchip\xc16\v1.25\support\peripheral_30F_24H_33F

For Pumpkin library for dsPIC33 : C:\Pumpkin\Library\DSPIC33\Inc and C:\Pumpkin\Library\DSPIC33\Src

For preliminary files from test : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1

Add lib : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1\MPLAB_C30\Pro-lib

For files from test : C:\Pumpkin\CubeSatKit\Example\all\all\CubeSatKit_Dev_Board\Test\Test1


5. Building

1- Add Header folders for compiler :
Right-click on your project > Properties > XC16 (Global Options) > Common include dirs [...] > Browse... > Select all directories containing headers

-> Compiler doesn't know otherwise include<...> in files

2- In order to avoid conflict between files of C:\Pumpkin\Salvo\Src and C:\Pumpkin\Salvo\Src\MCC30 :

You have to keep :
  • salvohook_idle.c of MCC30/ -> Remove it from Src
  • salvohook_interrupt_MCC30_IRQ.c -> Remove from Project all salvohook_interrupt.c
  • salvohook_wdt_MCC30_clrwdt.c -> Remove from Project all salvohook_wdt.c
  • salvoportmcc30-sm.s -> Remove from Project salvoportmcc30-lm.s if present

3- Right-click on your project > Properties > XC16 (Global Options) > Change Output file format from ELF to COFF

-> All libraries are dedicated to "coff"


6. Running

1- Connection to the development board and Run
-> You should have the following output :