Adafruit Data Logger Shield - Serial.begin()

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
holder3651
 
Posts: 2
Joined: Thu Dec 30, 2021 8:53 pm

Adafruit Data Logger Shield - Serial.begin()

Post by holder3651 »

The Adafruit Data Logger Shield uses the I2C bus to send and receive to the RTC and the SD Card, but those devices seem to require different data speeds; for the sample sketches the Serial.begin(57600) is used whereas for the SD Card Serial.begin(9600) is used.

Since in all the samples I could find, those bus speeds are established in void setup(), there seems to be a direct conflict. Please advise how the bus speed is to be managed.

I could understand if in Setup the speed is set for the RTC and then the setup done for the clock, then the speed is set for the SD Card and it's setup is done. But does that mean that in each cycle through void loop() when time is read we have to reset to RTC speed, then to write to the SD Card we have to change to it's speed repeatedly.

Or, does setup establish the bus speed for that particular device, so its already established for use in void loop()?

An example of data storage from sensors with date/time from the RTC would be useful.

User avatar
holder3651
 
Posts: 2
Joined: Thu Dec 30, 2021 8:53 pm

Re: Adafruit Data Logger Shield - Serial.begin()

Post by holder3651 »

I’ve seen on the Arduino code site that one can use Serial1.begin(), Serial2.begin(), etc but that results in a compiler error that the name Serial1 , etc, are not defined. Elsewhere, I see suggestions to use one speed, flush the serial port, then set the next speed.

How should I use the first option if it works? That is, how do I define Serial1, etc?

Does the second option make sense?

However, more fundamentally, do the Adafruit Data Logger SD card and RTC need to run at different speeds as implied by the sketches separately written for each; i.e. 9600 for the SD Card and 57600 for the RTC?

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit Data Logger Shield - Serial.begin()

Post by adafruit_support_bill »

The Adafruit Data Logger Shield uses the I2C bus to send and receive to the RTC and the SD Card,
The i2c bus is used for the RTC. The SD card uses the SPI bus.
for the sample sketches the Serial.begin(57600) is used whereas for the SD Card Serial.begin(9600) is used.
The Serial baud rate is not related to either the i2c bus or the SPI bus speeds. The baud rate specified in Serial.begin() merely controls the speed of serial communication back to your computer.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”