II - Tutorial - Simple project on CubeSat Kit » History » Version 11

COLIN, Tony, 12/16/2015 06:01 PM

1 1 COLIN, Tony
h1. II - Tutorial - Simple project on CubeSat Kit
2 1 COLIN, Tony
3 1 COLIN, Tony
{{>toc}}
4 1 COLIN, Tony
5 1 COLIN, Tony
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.
6 1 COLIN, Tony
7 1 COLIN, Tony
h2. 1. Inventory & Documentation
8 1 COLIN, Tony
9 9 COLIN, Tony
h3. 1.1 Equipment
10 1 COLIN, Tony
11 9 COLIN, Tony
See previous chapter [[I - Equipment]]
12 9 COLIN, Tony
13 10 COLIN, Tony
h3. 1.2 Five essential manuals to well begin
14 1 COLIN, Tony
15 10 COLIN, Tony
(1) attachment:"CubeSatKit Manual.pdf"
16 10 COLIN, Tony
(2) attachment:"CubeSat Kit SD Card and EFFS-THIN User Manual.pdf"
17 10 COLIN, Tony
(3) attachment:"Salvo User Manual.pdf"
18 10 COLIN, Tony
(4) attachment:"dsPIC33FJXXXGPX10 Manual.pdf"
19 10 COLIN, Tony
(5) attachment:"Development Board Manual.pdf"
20 9 COLIN, Tony
21 9 COLIN, Tony
h3. 1.3 From previous project : SPUTNIK STRIKES BACK
22 9 COLIN, Tony
23 1 COLIN, Tony
"Equipments":https://sourceforge.isae.fr/projects/project-cubesat/wiki/Equipment_inventory
24 1 COLIN, Tony
25 9 COLIN, Tony
h3. 1.4 From Pumpkin : Cubesat kit overview
26 1 COLIN, Tony
27 9 COLIN, Tony
"Training material - read this first":https://sourceforge.isae.fr/attachments/download/100/20120220_Pumpkin_CubeSat_Kit_Training.pdf - "Cubesat physical dimensions":https://sourceforge.isae.fr/attachments/download/496/cds_rev13_final.pdf
28 1 COLIN, Tony
29 1 COLIN, Tony
---
30 1 COLIN, Tony
31 1 COLIN, Tony
h2. 2. Elementary steps
32 1 COLIN, Tony
33 1 COLIN, Tony
1 - Download latest release of *MPLAB X IDE* on the "Website":http://www.microchip.com/pagehandler/en-us/family/mplabx/ under Downloads e.g. for Windows (x86/x64)  : MPLAB® X IDE v3.15
34 1 COLIN, Tony
-> Integrated Development Environment to implement code and either simulate it on computer or load it on electronic components
35 1 COLIN, Tony
36 1 COLIN, Tony
2 - Download latest release of *XC16 Compiler* for MPLAB on the "Website":http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/ under Downloads e.g. for Windows (x86/x64)  : MPLAB XC16 Compiler v1.25
37 1 COLIN, Tony
-> C compiler for 16 bits PIC processors from Microchip
38 1 COLIN, Tony
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
39 1 COLIN, Tony
40 1 COLIN, Tony
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
41 1 COLIN, Tony
Note : Take care to install it under \Microchip\xc16\v1.25\ (if this version)
42 1 COLIN, Tony
-> Essential libraries to program dsPIC33 such as <uart.h>, <timer.h> etc.
43 1 COLIN, Tony
44 1 COLIN, Tony
4 - *Test of connectivity* with ICD3
45 1 COLIN, Tony
i- Manually Install Driver " Microchip\MPLAB X IDE\Switcher\64bit\winusb " for ICD3 - "Tutorial here":http://microchip.wikidot.com/mplabx:manually-install-drivers-for-real-ice-or-icd 
46 1 COLIN, Tony
ii- Test :
47 1 COLIN, Tony
48 1 COLIN, Tony
p=. !Test_Interface.PNG!
49 1 COLIN, Tony
50 1 COLIN, Tony
-> Ready to work with development board
51 1 COLIN, Tony
52 1 COLIN, Tony
5 - Download necessary files for *CubeSat Kit* on "Cubesat Kit software for dsPIC33 microcontrollers":https://sourceforge.isae.fr/attachments/download/103/cubesatkit-dspic33-1.2.4-rc1.exe from Pumpkin
53 11 COLIN, Tony
-> Contains source files, libraries and examples for the dsPIC33 use in the CubeSat Kit
54 1 COLIN, Tony
55 1 COLIN, Tony
6 - Download necessary files for *Salvo* (dsPIC) on "Salvo OS for dsPIC33 microcontrollers":https://sourceforge.isae.fr/attachments/download/104/salvo-pro-dspic-4.3.0-rc1.exe and "EFFS Thin SD card support":https://sourceforge.isae.fr/attachments/download/105/cubesatkit-effs-thin-dspic33-1.9.3-rc3.exefrom Pumpkin
56 11 COLIN, Tony
-> Contains source files, libraries and examples for the use of the Real-Time Operating System (RTOS)
57 1 COLIN, Tony
58 1 COLIN, Tony
7 - Download Pumpkin's processor-specific "software libraries":http://www.pumpkininc.com/library/dspic33/ 1.0.1 and 1.0.2
59 1 COLIN, Tony
60 1 COLIN, Tony
---
61 1 COLIN, Tony
62 1 COLIN, Tony
h2. 3. Creation of a simple MPLAB X IDE project
63 1 COLIN, Tony
64 1 COLIN, Tony
1- *Settings* :
65 1 COLIN, Tony
i- Projects : Standalone Project
66 1 COLIN, Tony
ii- Device Family : 16-bits DSCs (dsPIC33)  Device : dsPIC33FJ256GP710
67 1 COLIN, Tony
iii- Tool : ICD 3 > 
68 1 COLIN, Tony
!Device.png!
69 1 COLIN, Tony
iv- Compiler : XC16
70 1 COLIN, Tony
71 1 COLIN, Tony
2- How to *add* your dedicated files :
72 1 COLIN, Tony
i- Right-click on Source Files > Add Existing Items From Folders... > Add Folder... > Select as Type of File : !C_Source.png! and chose your folder
73 5 COLIN, Tony
ii- For Headers see [[II - Tutorial - Simple project on CubeSat Kit#"5. - Building"|5. - Building]]
74 1 COLIN, Tony
iii- Right-click on Libraries > Add Library/Object File > Choose one library (1 by 1)
75 1 COLIN, Tony
76 1 COLIN, Tony
---
77 1 COLIN, Tony
78 1 COLIN, Tony
h2. 4. File management
79 1 COLIN, Tony
80 1 COLIN, Tony
For C-Files :  C:\Pumpkin\Salvo\Src
81 1 COLIN, Tony
82 1 COLIN, Tony
p=. !Salvo_Src.png!
83 1 COLIN, Tony
84 1 COLIN, Tony
For H-Files :  C:\Pumpkin\Salvo\Inc
85 1 COLIN, Tony
86 1 COLIN, Tony
p=. !Salvo_Inc.png!
87 1 COLIN, Tony
88 1 COLIN, Tony
For C-Files :  C:\Pumpkin\CubeSatKit\DSPIC33\src
89 1 COLIN, Tony
90 1 COLIN, Tony
p=. !PIC_src.png!
91 1 COLIN, Tony
92 1 COLIN, Tony
For H-Files :  C:\Pumpkin\CubeSatKit\DSPIC33\inc
93 1 COLIN, Tony
94 1 COLIN, Tony
p=. !PIC_inc.png!
95 1 COLIN, Tony
96 1 COLIN, Tony
For Libraries :  C:\Pumpkin\CubeSatKit\DSPIC33\lib\mcc30-v3
97 1 COLIN, Tony
98 1 COLIN, Tony
p=. !PIC_lib.png!
99 1 COLIN, Tony
100 1 COLIN, Tony
For peripheral libraries of dsPIC33F : C:\Program Files (x86)\Microchip\xc16\v1.25\support\peripheral_30F_24H_33F
101 1 COLIN, Tony
102 1 COLIN, Tony
p=. !Peripheral_Lib.png!
103 1 COLIN, Tony
104 1 COLIN, Tony
For Pumpkin library for dsPIC33 : C:\Pumpkin\Library\DSPIC33\Inc and C:\Pumpkin\Library\DSPIC33\Src
105 1 COLIN, Tony
106 1 COLIN, Tony
p=. !Pumpkin_Lib_Inc.png! !Pumpkin_Lib_Src.png!
107 1 COLIN, Tony
108 1 COLIN, Tony
For preliminary files from test : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1
109 1 COLIN, Tony
110 1 COLIN, Tony
p=. !PIC_Test1.png!
111 1 COLIN, Tony
112 1 COLIN, Tony
Add lib : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1\MPLAB_C30\Pro-lib
113 1 COLIN, Tony
114 1 COLIN, Tony
p=. !ProLib.png!
115 1 COLIN, Tony
116 1 COLIN, Tony
For files from test : C:\Pumpkin\CubeSatKit\Example\all\all\CubeSatKit_Dev_Board\Test\Test1
117 1 COLIN, Tony
118 1 COLIN, Tony
p=. !all_Test1.png!
119 1 COLIN, Tony
120 1 COLIN, Tony
---
121 1 COLIN, Tony
122 1 COLIN, Tony
h2. 5. Building
123 1 COLIN, Tony
124 1 COLIN, Tony
1- Add *Header folders* for compiler :
125 1 COLIN, Tony
Right-click on your project > Properties > XC16 (Global Options) > Common include dirs [...] > Browse... > Select all directories containing headers
126 1 COLIN, Tony
127 1 COLIN, Tony
p=. !Include.png!
128 1 COLIN, Tony
129 1 COLIN, Tony
-> Compiler doesn't know otherwise include<...> in files
130 1 COLIN, Tony
131 1 COLIN, Tony
2- In order to avoid conflict between files of C:\Pumpkin\Salvo\Src and C:\Pumpkin\Salvo\Src\MCC30 :
132 1 COLIN, Tony
133 1 COLIN, Tony
p=. !Conflict.png!
134 1 COLIN, Tony
135 1 COLIN, Tony
You have to *keep* :
136 7 COLIN, Tony
*  *salvohook_idle.c* of MCC30/ -> Remove it from Src 
137 6 COLIN, Tony
*  *salvohook_interrupt_MCC30_IRQ.c* -> Remove from Project all salvohook_interrupt.c
138 6 COLIN, Tony
*  *salvohook_wdt_MCC30_clrwdt.c* -> Remove from Project all salvohook_wdt.c
139 6 COLIN, Tony
*  *salvoportmcc30-sm.s* -> Remove from Project salvoportmcc30-lm.s if present
140 1 COLIN, Tony
141 1 COLIN, Tony
3- Right-click on your project > Properties > XC16 (Global Options) > Change Output file format from ELF to COFF
142 1 COLIN, Tony
143 1 COLIN, Tony
p=. !Output_File.png!
144 1 COLIN, Tony
145 1 COLIN, Tony
-> All libraries are dedicated to "coff"
146 1 COLIN, Tony
147 1 COLIN, Tony
---
148 1 COLIN, Tony
149 1 COLIN, Tony
h2. 6. Running
150 1 COLIN, Tony
151 1 COLIN, Tony
1- Connection to the development board and Run
152 1 COLIN, Tony
-> You should have the following output :
153 1 COLIN, Tony
154 1 COLIN, Tony
p=. !Build.png!