Go Down

Topic: How conect micro SD card with ArbotiX-M (Read 670 times) previous topic - next topic

urko_18

Hello everyone!!

I wanted to ask if anyone knows if it is possible to connect a micro SD card with the ArbotiX-M.

My goal is to save more movements of some servos in order to move a robotic arm, since I have the SRAM memory of the arbotix completely full.

Thank you!!

Urko

PaulS

Quote
My goal is to save more movements of some servos in order to move a robotic arm, since I have the SRAM memory of the arbotix completely full.
If SRAM is "completely full", where will you create the 512 byte buffer needed to read from/write to the SD card?

The "ArbotiX-M" is NOT an Arduino that you can order from the Arduino store. If you are going to ask questions about it here, it would make sense to post a link to it.
The art of getting good answers lies in asking good questions.

urko_18

Using the SD card, everything that the SRAM memory now is saving will pass to the card, so, it will allow space for that which you mention to me.

I didn´t know, sorry, here is a link with information about the ArbotiX-M:

http://www.trossenrobotics.com/p/arbotix-robot-controller.aspx

Thank you,

Urko.

PaulS

THIS is a link: http://www.trossenrobotics.com/p/arbotix-robot-controller.aspx

The icon to the left of the x2 icon does that.

It is not clear which pins are the SPI pins on that board. It isn't even clear that the board supports SPI, but I presume that it does.
The art of getting good answers lies in asking good questions.

oqibidipo

It is not clear which pins are the SPI pins on that board. It isn't even clear that the board supports SPI, but I presume that it does.
It has a dedicated 6-pin header labeled with an anagram of SPI so... ;)

urko_18

Okey tank you!!

Just another question, i´am looking how i can do the connection but...
How can I know which pins correspond to each entry of VCC, GND, MISO, MOSI, SCK ...?

For example, to conect to ARDUINO UNO this is the connection:
http://www.naylampmechatronics.com/modules//smartblog/images/38-single-default.jpg

But, to conect to the ArbotiX-M??

Thank you,

Urko.

PaulS

Quote
But, to conect to the ArbotiX-M??
Ask the people you bought it from.
The art of getting good answers lies in asking good questions.

urko_18

I already asked them and they still do not answer me ...

I have found in the datasheet of the ArbotiX-M chip (http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42744-ATmega644P_Datasheet.pdf)the pins that correspond to MISO, MOSI, SCK and SS:

-SCK/PCINT15 - Port B, Bit 7- SCK: Master Clock output, Slave Clock input pin for SPI0 channel. When the SPI0 is enabledas a slave, this pin is configured as an input regardless of the setting of DDB7. When theSPI0 is enabled as a master, the data direction of this pin is controlled by DDB7. When thepin is forced to be an input, the pull-up can still be controlled by the PORTB7 bit.- PCINT15: Pin Change Interrupt source 15. The PB7 pin can serve as an external interruptsource.

-MISO/PCINT14 - Port B, Bit 6- MISO: Master Data input, Slave Data output pin for SPI channel. When the SPI0 is enabledas a master, this pin is configured as an input regardless of the setting of DDB6. When theSPI is enabled as a slave, the data direction of this pin is controlled by DDB6. When the pin isforced to be an input, the pull-up can still be controlled by the PORTB6 bit.- PCINT14: Pin Change Interrupt source 14. The PB6 pin can serve as an external interruptsource.

-MOSI/PCINT13 - Port B, Bit 5- MOSI: SPI Master Data output, Slave Data input for SPI channel. When the SPI0 is enabledas a slave, this pin is configured as an input regardless of the setting of DDB5. When the SPIis enabled as a master, the data direction of this pin is controlled by DDB5. When the pin isforced to be an input, the pull-up can still be controlled by the PORTB5 bit.- PCINT13: Pin Change Interrupt source 13. The PB5 pin can serve as an external interruptsource.

-SS/OC0B/PCINT12 - Port B, Bit 4- SS: Slave Port Select input. When the SPI is enabled as a slave, this pin is configured as aninput regardless of the setting of DDB4. As a slave, the SPI0 is activated when this pin isdriven low. When the SPI is enabled as a master, the data direction of this pin is controlled byDDB4. When the pin is forced to be an input, the pull-up can still be controlled by thePORTB4 bit.- OC0B: Output Compare Match B output. The PB4 pin can serve as an external output for theTimer/Counter0 Output Compare. The pin has to be configured as an output (DDB4 set "1") toserve this function. The OC0B pin is also the output pin for the PWM mode timer function.- PCINT12: Pin Change Interrupt source 12. The PB4 pin can serve as an external interruptsource

What I understand is that each pin can get to behave in different ways or forms, for example the Port B, Bit 6, can be the MISO or an interruption. What I do not know is how to configure it, that is, what code should be set to work as MISO, MOSI, SCK and SS instead of pins with interruption for example ... I mean, I can not put only pin (4) to refer to the pin of the SS no?


Other question, i have to configurate the arduino.h library? because in this library i know that the following code appear:

Code: [Select]

#define PIN_SPI_SS    (10)
#define PIN_SPI_MOSI  (11)
#define PIN_SPI_MISO  (12)
#define PIN_SPI_SCK   (13)

static const uint8_t SS   = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK  = PIN_SPI_SCK;


But i don't know if i have to configure this library and i don´t know neither if there exists a library of arbotix.h...do anyone know?

urko_18

I finally managed to connect the ArbotiX-M with the microSD reader!

If someone ever wants or needs to make the connections, here are the pins that should be connected and a simple reading program:


conections:

microSD lector   ArbotiX-M

GND                           GND
+3.3V                 No conect
+5V                            5V
CS                    Pin 5 (D4/PB[4])
MOSI                Pin 6 (D5/PB[5])
SCK                   Pin8 (D7/PB[7])
MISO                 Pin7 (D6/PB[6])
SD CARD           Pin 4 (D3/PB[3])

program to reed from the SD:

Code: [Select]

#include <SPI.h>
#include <SD.h>
File myFile;


void setup()
{
  Serial.begin(9600);
  Serial.print("initializing SD ...");
  if (!SD.begin(4)) {
    Serial.println("It failed to initialize");
    return;
  }
  Serial.println("successful initialization");
 
  myFile = SD.open("Prueba.txt");//WE OPEN THE FILE
  if (myFile) {
    Serial.println("Prueba.txt:");
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    myFile.close(); //WE CLOSE THE FILE
  } else {
    Serial.println("Error opening the file");
  }
}


void loop()
{
 
}

Go Up