Skip to content

Commit 8ffeec2

Browse files
author
Nathan Seidle
committed
Add extra baud rates and notes to serial testing sketches.
1 parent 25dceba commit 8ffeec2

File tree

2 files changed

+73
-25
lines changed

2 files changed

+73
-25
lines changed

Firmware/Test Sketches/Serial Logging/ConstantSerialBlastTest/ConstantSerialBlastTest.ino

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,33 @@ int testAmt = 3;
99
//At 57600, testAmt of 10 takes about 1 minute, 40 takes about 5 minutes
1010
//At 115200, testAmt of 30 takes about 1 minute
1111

12-
13-
1412
unsigned long startTime = 0;
1513

1614
void setup()
1715
{
1816
pinMode(ledPin, OUTPUT);
1917

2018
Serial.begin(115200);
19+
Serial.println();
2120
Serial.println("Run OpenLog Test");
2221

2322
int rate = 115200 * 4;
2423
Serial1.begin(rate);
25-
Serial.print("Baud rate: ");
26-
Serial.println(rate);
2724

28-
Serial1.print("Hello");
25+
Serial.print("Current output baud rate: ");
26+
Serial.println(rate);
2927

28+
Serial.println("s)end test blob of text");
29+
Serial.println("1)Set baud to 115200");
30+
Serial.println("2)Set baud to 230400");
31+
Serial.println("3)Set baud to 460800");
32+
Serial.println("4)Set baud to 500000");
33+
Serial.println("5)Set baud to 691200");
34+
Serial.println("6)Set baud to 921600");
35+
Serial.println("a)Increase blob size");
36+
Serial.println("d)Decrease blob size");
37+
38+
//enableBurstMode(); //Go to 96MHz
3039
}
3140

3241
void loop()
@@ -57,13 +66,18 @@ void loop()
5766
}
5867
else if (incoming == '4')
5968
{
60-
Serial.println("Serial set to: 921600");
61-
Serial1.begin(921600);
69+
Serial.println("Serial set to: 500000");
70+
Serial1.begin(500000);
6271
}
6372
else if (incoming == '5')
6473
{
65-
Serial.println("Serial set to: 500000");
66-
Serial1.begin(500000);
74+
Serial.println("Serial set to: 691200");
75+
Serial1.begin(691200);
76+
}
77+
else if (incoming == '6')
78+
{
79+
Serial.println("Serial set to: 921600");
80+
Serial1.begin(921600);
6781
}
6882
else if (incoming == 'a')
6983
{
@@ -126,8 +140,11 @@ void sendBlob()
126140

127141
unsigned long totalCharacters = (long)testAmt * 100 * 100;
128142
Serial.print("Characters pushed: ");
143+
Serial.flush();
129144
Serial.println(totalCharacters);
130145
Serial.print("Time taken (s): ");
146+
Serial.flush();
131147
Serial.println((millis() - startTime) / 1000.0, 2);
132148
Serial.println("Done!");
149+
Serial.flush();
133150
}

Firmware/Test Sketches/Serial Logging/OpenLog_Bare_Serial/OpenLog_Bare_Serial.ino

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/*
22
October 11th, 2019
3-
4-
Increase local serial, turn off except when syncing
5-
Try better grade card
3+
4+
A stripped down sketch to test the reception of different speeds of serial
5+
and recording them to an SD card. Use with another board (RedBoard Artemis)
6+
and the ConstantSerialBlastTest.ino to send blocks of text. This sketch
7+
will output the # of bytes received so you can quickly see if all 30,000
8+
bytes made it over or if bytes were dropped.
69
710
460800bps = 2.17 * 10^-6 or 2.17us per bit
811
10 bits to the byte so 21.7us per byte
@@ -11,25 +14,29 @@
1114
16384 buffer size will allow for up to 355.532ms before bytes are dropped
1215
4096 buffer size will allow for up to 88.75ms before bytes are dropped
1316
14-
How big is RX FIFO within HAL? 32 bytes
15-
Is there a 'nearly full' interrupt for the RX FIFO?
16-
We could check the RX FIFO empty bit in the ISR in a loop
17-
We could increase the ISR priority level
18-
1917
ISR is currently 16us which supports 460800. We can burst mode to 8.5us.
18+
19+
With the most recent pull of the Apollo3 core from Github (ISR reduced, buffers
20+
increased to 4096), and a 512GB card, this sketch can correctly receive/store
21+
non-stop serial at 500000bps. Burst mode is not needed.
22+
23+
691200bps is possible in burst mode
2024
2125
*/
2226

2327
//microSD Interface
2428
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
2529
#include <SPI.h>
26-
#include <SdFat.h> //We do not use the built-in SD.h file because it calls Serial.print
30+
#include <SdFat.h>
2731

2832
const byte PIN_MICROSD_CHIP_SELECT = 10;
2933
const byte PIN_MICROSD_POWER = 15; //x04
3034

31-
SdFat sd;
32-
SdFile serialDataFile; //Record all incoming serial to this file
35+
SdFs sd; //exFat Support
36+
FsFile serialDataFile; //Record all incoming serial to this file
37+
38+
//SdFat sd;
39+
//SdFile serialDataFile; //Record all incoming serial to this file
3340
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
3441

3542
long overallStartTime; //Used to calc the actual update rate.
@@ -100,6 +107,16 @@ void setup() {
100107

101108
overallStartTime = millis();
102109
//enableBurstMode(); //Go to 96MHz
110+
111+
Serial.println("1)Set baud to 115200");
112+
Serial.println("2)Set baud to 230400");
113+
Serial.println("3)Set baud to 460800");
114+
Serial.println("4)Set baud to 500000");
115+
Serial.println("5)Set baud to 691200");
116+
Serial.println("6)Set baud to 921600");
117+
Serial.println("r)reset count");
118+
Serial.println("b)Enable Burst Mode");
119+
Serial.println("d)Disable Burst Mode");
103120
}
104121

105122
void loop()
@@ -115,7 +132,6 @@ void loop()
115132
serialDataFile.write(incomingBuffer, sizeof(incomingBuffer)); //Record the buffer to the card
116133
incomingBufferSpot = 0;
117134
}
118-
119135
charsReceived++;
120136
}
121137
lastSeriaLogSyncTime = millis();
@@ -162,19 +178,34 @@ void loop()
162178
}
163179
else if (incoming == '4')
164180
{
165-
Serial.println("Serial set to: 921600");
166-
SerialLog.begin(921600);
181+
Serial.println("Serial set to: 500000");
182+
SerialLog.begin(500000);
167183
}
168184
else if (incoming == '5')
169185
{
170-
Serial.println("Serial set to: 500000");
171-
SerialLog.begin(500000);
186+
Serial.println("Serial set to: 691200");
187+
SerialLog.begin(691200);
188+
}
189+
else if (incoming == '6')
190+
{
191+
Serial.println("Serial set to: 921600");
192+
SerialLog.begin(921600);
172193
}
173194
else if (incoming == 'r')
174195
{
175196
Serial.println("Total count reset");
176197
charsReceived = 0;
177198
}
199+
else if (incoming == 'e')
200+
{
201+
Serial.println("Burst mode enabled");
202+
enableBurstMode(); //Go to 96MHz
203+
}
204+
else if (incoming == 'd')
205+
{
206+
Serial.println("Burst mode disabled");
207+
disableBurstMode(); //Go to 48MHz
208+
}
178209
else if (incoming == '\r' || incoming == '\n')
179210
{
180211
//Do nothing

0 commit comments

Comments
 (0)