You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: include/Max1148.hpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,7 @@ class Max1148{
77
77
*/
78
78
voidcsh();
79
79
/**
80
-
* @brief Reads an average ADC value from the Max1148 ADC. Uses Arduino's SPI library.
80
+
* @brief Reads an average ADC value from the Max1148 ADC. Uses Arduino's SPI library. We don't use this anymore because we wanted to interleave ADC sampling between channels.
81
81
*
82
82
* @param avg_num The number of samples to average.
83
83
*/
@@ -89,7 +89,7 @@ class Max1148{
89
89
public:
90
90
/**
91
91
* @brief ADC constructor. Sets cs_pin as per ADC_CS_PIN macro. Chooses channel from Channel enum.
92
-
* @param channel The channel to read from. Format: CHAN0, CHAN1, etc.
92
+
* @param channel The channel to read from. Format: CHAN0, CHAN1, etc. I don't remember why it has to be static_cast but it works.
Copy file name to clipboardExpand all lines: src/main.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ GSE-D is configured to program the board. Simply connect to the board with USB,
17
17
18
18
pio run
19
19
20
-
Make sure you fetch and pull changes from git before programming the board.
20
+
Make sure you fetch and pull changes from git before programming the board. This will build the project again before uploading, but it should be very fast.
21
21
22
22
## Notes and Quirks
23
23
The board uses an external crystal oscillator, rather than the included ceramic oscillator on the Due. This required some changes that are not included in this documentation. First, a modded_system_sam3xa.c file is included in src/ to change the startup clock settings. Then, replace_libsam.py replaces the gcc_rel.a file that contains the precompiled startup code with our modded version. This required manually including the CMSIS libraries in /src/.
Copy file name to clipboardExpand all lines: src/modded_system_sam3xa.c
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
#include"cmsis_include/sam3xa.h"
2
2
3
-
// copied from C:\Users\<user>\.platformio\packages\framework-cmsis-atmel\CMSIS\Device\ATMEL\sam3xa\source\system_sam3xa.c
3
+
/**
4
+
* @file modded_system_sam3xa.c
5
+
* @brief Rewrite of system_sam3xa.c to support the external crystal oscillator on the shield. 317 Lab changes are flagged in comments.
6
+
* This is compiled into modded_libsam_3x8e_gcc_rel.a, which is linked into the final binary with replace_libsam.py. We have to do this because the Arduino framework uses a precompiled library for initial chip setup.
7
+
* This allows us to modify clock settings without changing the Platformio build process.
8
+
*/
4
9
5
10
/* @cond 0 */
6
11
/**INDENT-OFF**/
@@ -18,7 +23,7 @@ extern "C" {
18
23
uint32_tSystemCoreClock=CHIP_FREQ_MAINCK_RC_4MHZ;
19
24
20
25
/**
21
-
* \brief Setup the microcontroller system.
26
+
* @brief Setup the microcontroller system.
22
27
* Initialize the System and update the SystemFrequency variable.
23
28
*/
24
29
voidSystemInit( void )
@@ -30,12 +35,13 @@ void SystemInit( void )
30
35
/* Initialize main oscillator */
31
36
if ( !(PMC->CKGR_MOR&CKGR_MOR_MOSCSEL) )
32
37
{
38
+
//317 LAB - the last flag here bypasses the internal RC oscillator
//317 LAB - I don't fully understand why this flag is necessary, but selecting the crystal oscillator with the bypass flag still routes through the external oscillator.
0 commit comments