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

COLIN, Tony, 12/15/2015 10:36 AM

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 1 COLIN, Tony
h3. 1.1 From previous project : SPUTNIK STRIKES BACK
10 1 COLIN, Tony
11 1 COLIN, Tony
"Equipments":https://sourceforge.isae.fr/projects/project-cubesat/wiki/Equipment_inventory
12 1 COLIN, Tony
"Preliminary Tests":https://sourceforge.isae.fr/projects/project-cubesat/wiki/Preliminary_tests
13 1 COLIN, Tony
14 1 COLIN, Tony
h3. 1.2 From Pumpkin : Cubesat kit overview
15 1 COLIN, Tony
16 1 COLIN, Tony
"Training material - read this first":https://sourceforge.isae.fr/attachments/download/100/20120220_Pumpkin_CubeSat_Kit_Training.pdf - "User manual":https://sourceforge.isae.fr/attachments/download/101/cubesatkitmanual.pdf - "Cubesat physical dimensions":https://sourceforge.isae.fr/attachments/download/496/cds_rev13_final.pdf
17 1 COLIN, Tony
18 1 COLIN, Tony
---
19 1 COLIN, Tony
20 1 COLIN, Tony
h2. 2. Elementary steps
21 1 COLIN, Tony
22 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
23 1 COLIN, Tony
-> Integrated Development Environment to implement code and either simulate it on computer or load it on electronic components
24 1 COLIN, Tony
25 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
26 1 COLIN, Tony
-> C compiler for 16 bits PIC processors from Microchip
27 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
28 1 COLIN, Tony
29 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
30 1 COLIN, Tony
Note : Take care to install it under \Microchip\xc16\v1.25\ (if this version)
31 1 COLIN, Tony
-> Essential libraries to program dsPIC33 such as <uart.h>, <timer.h> etc.
32 1 COLIN, Tony
33 1 COLIN, Tony
4 - *Test of connectivity* with ICD3
34 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 
35 1 COLIN, Tony
ii- Test :
36 1 COLIN, Tony
37 1 COLIN, Tony
p=. !Test_Interface.PNG!
38 1 COLIN, Tony
39 1 COLIN, Tony
-> Ready to work with development board
40 1 COLIN, Tony
41 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
42 1 COLIN, Tony
-> Contains ...
43 1 COLIN, Tony
44 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
45 1 COLIN, Tony
-> Real-Time ...
46 1 COLIN, Tony
-> Contains ...
47 1 COLIN, Tony
48 1 COLIN, Tony
7 - Download Pumpkin's processor-specific "software libraries":http://www.pumpkininc.com/library/dspic33/ 1.0.1 and 1.0.2
49 1 COLIN, Tony
50 1 COLIN, Tony
---
51 1 COLIN, Tony
52 1 COLIN, Tony
h2. 3. Creation of a simple MPLAB X IDE project
53 1 COLIN, Tony
54 1 COLIN, Tony
1- *Settings* :
55 1 COLIN, Tony
i- Projects : Standalone Project
56 1 COLIN, Tony
ii- Device Family : 16-bits DSCs (dsPIC33)  Device : dsPIC33FJ256GP710
57 1 COLIN, Tony
iii- Tool : ICD 3 > 
58 1 COLIN, Tony
!Device.png!
59 1 COLIN, Tony
iv- Compiler : XC16
60 1 COLIN, Tony
61 1 COLIN, Tony
2- How to *add* your dedicated files :
62 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
63 4 COLIN, Tony
ii- For Headers see [[II - Tutorial - Simple project on CubeSat Kit#"E - Building"|E - Building]]
64 1 COLIN, Tony
iii- Right-click on Libraries > Add Library/Object File > Choose one library (1 by 1)
65 1 COLIN, Tony
66 1 COLIN, Tony
---
67 1 COLIN, Tony
68 1 COLIN, Tony
h2. 4. File management
69 1 COLIN, Tony
70 1 COLIN, Tony
For C-Files :  C:\Pumpkin\Salvo\Src
71 1 COLIN, Tony
72 1 COLIN, Tony
p=. !Salvo_Src.png!
73 1 COLIN, Tony
74 1 COLIN, Tony
For H-Files :  C:\Pumpkin\Salvo\Inc
75 1 COLIN, Tony
76 1 COLIN, Tony
p=. !Salvo_Inc.png!
77 1 COLIN, Tony
78 1 COLIN, Tony
For C-Files :  C:\Pumpkin\CubeSatKit\DSPIC33\src
79 1 COLIN, Tony
80 1 COLIN, Tony
p=. !PIC_src.png!
81 1 COLIN, Tony
82 1 COLIN, Tony
For H-Files :  C:\Pumpkin\CubeSatKit\DSPIC33\inc
83 1 COLIN, Tony
84 1 COLIN, Tony
p=. !PIC_inc.png!
85 1 COLIN, Tony
86 1 COLIN, Tony
For Libraries :  C:\Pumpkin\CubeSatKit\DSPIC33\lib\mcc30-v3
87 1 COLIN, Tony
88 1 COLIN, Tony
p=. !PIC_lib.png!
89 1 COLIN, Tony
90 1 COLIN, Tony
For peripheral libraries of dsPIC33F : C:\Program Files (x86)\Microchip\xc16\v1.25\support\peripheral_30F_24H_33F
91 1 COLIN, Tony
92 1 COLIN, Tony
p=. !Peripheral_Lib.png!
93 1 COLIN, Tony
94 1 COLIN, Tony
For Pumpkin library for dsPIC33 : C:\Pumpkin\Library\DSPIC33\Inc and C:\Pumpkin\Library\DSPIC33\Src
95 1 COLIN, Tony
96 1 COLIN, Tony
p=. !Pumpkin_Lib_Inc.png! !Pumpkin_Lib_Src.png!
97 1 COLIN, Tony
98 1 COLIN, Tony
For preliminary files from test : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1
99 1 COLIN, Tony
100 1 COLIN, Tony
p=. !PIC_Test1.png!
101 1 COLIN, Tony
102 1 COLIN, Tony
Add lib : C:\Pumpkin\CubeSatKit\Example\dsPIC33\dsPIC33FJ256GP710\CubeSat_Kit_Dev_Board\Test\Test1\MPLAB_C30\Pro-lib
103 1 COLIN, Tony
104 1 COLIN, Tony
p=. !ProLib.png!
105 1 COLIN, Tony
106 1 COLIN, Tony
For files from test : C:\Pumpkin\CubeSatKit\Example\all\all\CubeSatKit_Dev_Board\Test\Test1
107 1 COLIN, Tony
108 1 COLIN, Tony
p=. !all_Test1.png!
109 1 COLIN, Tony
110 1 COLIN, Tony
---
111 1 COLIN, Tony
112 1 COLIN, Tony
h2. 5. Building
113 1 COLIN, Tony
114 1 COLIN, Tony
1- Add *Header folders* for compiler :
115 1 COLIN, Tony
Right-click on your project > Properties > XC16 (Global Options) > Common include dirs [...] > Browse... > Select all directories containing headers
116 1 COLIN, Tony
117 1 COLIN, Tony
p=. !Include.png!
118 1 COLIN, Tony
119 1 COLIN, Tony
-> Compiler doesn't know otherwise include<...> in files
120 1 COLIN, Tony
121 1 COLIN, Tony
2- In order to avoid conflict between files of C:\Pumpkin\Salvo\Src and C:\Pumpkin\Salvo\Src\MCC30 :
122 1 COLIN, Tony
123 1 COLIN, Tony
p=. !Conflict.png!
124 1 COLIN, Tony
125 1 COLIN, Tony
You have to *keep* :
126 1 COLIN, Tony
*  salvohook_idle.c of MCC30 -> Remove it from Src 
127 1 COLIN, Tony
*  salvohook_interrupt_MCC30_IRQ.c -> Remove from Project all salvohook_interrupt.c
128 1 COLIN, Tony
*  salvohook_wdt_MCC30_clrwdt.c -> Remove from Project all salvohook_wdt.c
129 1 COLIN, Tony
*  salvoportmcc30-sm.s -> -> Remove from Project salvoportmcc30-lm.s if present
130 1 COLIN, Tony
131 1 COLIN, Tony
3- Right-click on your project > Properties > XC16 (Global Options) > Change Output file format from ELF to COFF
132 1 COLIN, Tony
133 1 COLIN, Tony
p=. !Output_File.png!
134 1 COLIN, Tony
135 1 COLIN, Tony
-> All libraries are dedicated to "coff"
136 1 COLIN, Tony
137 1 COLIN, Tony
---
138 1 COLIN, Tony
139 1 COLIN, Tony
h2. 6. Running
140 1 COLIN, Tony
141 1 COLIN, Tony
1- Connection to the development board and Run
142 1 COLIN, Tony
-> You should have the following output :
143 1 COLIN, Tony
144 1 COLIN, Tony
p=. !Build.png!