Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: How conect micro SD card with ArbotiX-M

  1. #11

    Re: How conect micro SD card with ArbotiX-M

    What Tician was mentioning, is that ... First some background.

    The officially released Trossen Arbotix-M stuff was released for Arduino 1.0.4 if I remember the correct 1.0.x... Which is ancient. I later tried to get them migrated over to more recent builds including now the 1.8.5 Arduino (Current release). They had a Beta setup to try it out, before the person doing the Beta left the company... During that time frame, @tician, did the work necessary to make it easier to install the Arbotix stuff, using the Arduino Board Manager stuff. This is the same way you add in special boards from Adafruit, or Sparkfun or Robotis, or ...

    So to add a new board type to Arduino, that Arduino as not pre-packaged into the release, you do the following:

    You start up Arduino. And you bring up the preferences dialog. In this dialog, maybe 3/4 of the way down you will see an item: Additional Boards Manager URLs:

    Where you enter (or add separated by commas)
    Code:
    https://tician.github.io/arbotix/package_trossen_arbotix_index.json
    Note: I don't feel this is pathetic at all, but what is unfortunate is that Trossen has not picked this up and if necessary made a few minor changes, like maybe add a few more libraries and made an official location...

    Then you OK out the dialog.

    You then go to the Tools->Boards menu item and choose the Board manager. Somewhere down in that list (probably near the end, you will see the Arbotix AVR Boards by tician, which you can click on the info and choose to do the install...

    Now back to your code..

    A couple of things. First off I assume that you had which ever version of the IDE you were trying actually successfully download the program to your Arbotix.

    I assume that you have board type set to the Arbotix-m and you have the Port set to the correct port (the one associated with the Arbotix-m board).

    I also assume that when you opened the Serial monitor, that you choose the baud rate of 9600 to match the baud rate you specified in the program above.

    Note: I would also maybe put in a delay at the start of the program to make sure that the serial captures the data. Like maybe a delay(1000); right after the Serial.begin()...

    And yes I believe the SD.begin will call through to SPI.begin(), which will initialize the proper state for each of the SPI pins. I believe the 4 passed into it is the CS pin, which it will also initialize to the correct state.

    I am also assuming that the SD device you have, probably includes Pull UP resistors for some of the SPI pins, like MISO pin? I don't remember if you put in a link to the actual hardware device you are using.

  2. #12

    Re: How conect micro SD card with ArbotiX-M

    Sorry i didn´t realiz that you have answered,
    Thank you!!

    Ok, I have installed that URL that you told me, and now I get two new plates to choose from:
    -Arbotix m
    -Arbotix w / RX shield

    Click image for larger version. 

Name:	Placas arbotix.png 
Views:	40 
Size:	4.5 KB 
ID:	7183
    Is alright?

    Continuing, I have a micro SD reader that I came across by chance, I sent a link with the photo of the reader's connection to an arduino UNO, it is the following:
    http://www.naylampmechatronics.com/m...le-default.jpg

    First off I assume that you had which ever version of the IDE you were trying actually successfully download the program to your Arbotix.
    -Yes i have succesfully download, and my IDE is the 1.8.5

    I assume that you have board type set to the Arbotix-m and you have the Port set to the correct port (the one associated with the Arbotix-m board).
    -Yes, that is!

    I also assume that when you opened the Serial monitor, that you choose the baud rate of 9600 to match the baud rate you specified in the program above.
    -Yes is set like that.

    Whar I don´t know if the micro SD reader has resistenace, but I doubt it a lot, since i do not see more than one r1, how could I solve that?


    Many thanks!

    Urko.
    Last edited by urko_18; 03-13-2018 at 11:29 AM.

  3. #13

    Re: How conect micro SD card with ArbotiX-M

    Again what version of Arduino? What SD library... Do you have an SD card in the reader? Is it initialized and formatted? If so what is it formatted as? FAT?

    If it failed to initialize, I would tend to look in the SD library at the begin code and see if you can add or enable additional Serial outputs to localize down what failed...

  4. #14

    Re: How conect micro SD card with ArbotiX-M

    I have edit my last post because i didn´t realize that you had answered me, sorry.

    Yes i have a SD card in the reader, and yes, my SD was formatted by using SD Card Formatter program.

    Okey I will try to look in the SD library!

    Thanks,

    Urko.
    Last edited by urko_18; 03-14-2018 at 03:33 AM.

  5. #15

    Question Re: How conect micro SD card with ArbotiX-M

    Hellow another time!

    I continue trying to implement this conection, my last attempt was this: (i change the name of the pin, because i know that the pin of SS is the 4 one of the port B of the arbotix)

    Code:
    #include <SPI.h>
    #include <SD.h>
    File myFile;
    
    
    #define PIN_SPI_SS    (PINB & 0x04)
    const int chipSelect = PINB & 0x04;
    void setup()
    {
      Serial.begin(9600);
      delay(1000); 
    //  PORTB |= 0x1E;
    //  PCICR |= (1 << PCIE1);
    //  PCMSK1 |= 0x1E;
      pinMode(PINB & 0x04, OUTPUT); 
      Serial.print("initializing SD ...");
      if (!SD.begin(chipSelect)) {
        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()
    {
      
    }
    But the program do the same than before...
    maybe is because of the internal resistance of the micro SD reader? as KurtEck has said?
    How can I solucionate this problem?

    Thanks!

    Urko.

  6. #16

    Re: How conect micro SD card with ArbotiX-M

    Right now, not sure what you are trying?

    I am pretty sure the chip select information you pass into SD.begin is an Arduino pin number... It does not care what port or the like it is on... The slight caveat to this statement is that maybe internally it may decide to map the pin number to a port and a mask to use as a speed up, but that would be internal to the library.

    Again things I would do would include figure out where the SD.begin() if failing.

    If you look at the code you will see something like:
    Code:
    boolean SDClass::begin(uint8_t csPin) {
      /*
    
        Performs the initialisation required by the sdfatlib library.
    
        Return true if initialization succeeds, false otherwise.
    
       */
      return card.init(SPI_HALF_SPEED, csPin) &&
             volume.init(card) &&
             root.openRoot(volume);
    }
    So you know it is failing in one of the three calls... You might add Serial.print statements in the functions called to see what is going on... Or you could add more info to this code like:
    Code:
    boolean SDClass::begin(uint8_t csPin) {
      /*
    
        Performs the initialisation required by the sdfatlib library.
    
        Return true if initialization succeeds, false otherwise.
    
       */
      if (!card.init(SPI_HALF_SPEED, csPin)) {
        Serial.println("Card Init Failed");
        return false;
      }
      if (!volume.init(card)) {
        Serial.println("Volume Init Failed");
        return false;
      }
      if (!root.openRoot(volume)) {
        Serial.println("Open Root Failed");
        return false;
      }
      return true;
    }
    Note: Typed in on the fly so could be issues... Once you figure out which of these fail, you can then go into where these functions call off to and figure out where that fails...

  7. #17

    Re: How conect micro SD card with ArbotiX-M

    I tried this morning to write what you have put me in the library of the SD.h, but when I run the program, the same message has appear in the serial monitor, that te SD fails to initialize, without specifying any of the three options (root, volume, card) ...


    The truth is that I do not know what else to try ... I have reviewed all the connections more than once and they are fine, and two or three weeks ago I wrote to the email of vanadiumlabs about the problem, but they have not answered me.


    Urko.

  8. #18

    Re: How conect micro SD card with ArbotiX-M

    Make sure you are editing the version of the SD library that is being used...

    That is, check your build. If there are multiple versions of a library, it will usually give message like, using this library and not using that library. For the heck of it, I would also add something like: Serial.println("SD Begin called");
    right at the start of that function, which again should print something. Else it is not being called!

    and/or check to see if there are multiple begin methods, that may depend on what type of architecture the board is... In your case AVR, but there may be some other portions of code for different ARM boards like for DUE and M0...

    As for vanadiumlabs I am not sure they really exist anymore. I believe the Arbotix-m was done by Tyberius (Andrew) who I believe is no longer working with Trossen... You might try emailing support at Trossen, but my gut tells me that they may direct you back to the forum...

  9. #19

    Re: How conect micro SD card with ArbotiX-M

    Yes, I'm sure I'm in the correct version but, I do not know what happens that does not connect well ... i had put what you say of "SD Begin called" but also didn´t appear..


    Thanks KurtEck, I will send an email to trossen, to see if I am lucky and they respond to me although I also believe that they will send me here hahaha


    At the moment I'm going to put aside this problem of have little memory space in the ArbotiX-M, and I'll be working on it later!


    Now I'm going to focus on the torque control of my robot, which I have already asked some time ago in some threads and I have forgotten it ...


    And of course, Thank you very much to all of you for the advices that you have been giving me !!!!!


    If I ever connect the SD with the ArbotiX-M I will let you know through this forum and I will explain it here too !!




    Urko

  10. #20

    Re: How conect micro SD card with ArbotiX-M

    Normally if the message did not display and nothing else displayed after that, I would say that maybe the code hung... But you say the message after that call did display, so it obviously did not hang...

    If nothing else displays, I then typically, go to where I did the Serial.println and add a Serial.flush()

    Something like:
    Serial.println("SD Begin Called"); Serial.flush();

    This causes the code to wait and send the current cached Serial data and wait for that to complete before continuing... You might want to try that here as well any way...

    If you still don't see any of these messages, than the code is almost for sure not being called! Sometimes when I get strange compiling issues, I might add a garbage line to the code in the suspected function:
    Like: This is Garbage

    And then try to build. If it does not give you a compile error, than that code is not included in the build...

    Also might help to know which version of SD library you are using. If you are using the one from Arduino, that comes from:
    https://github.com/arduino-libraries/SD

    Note: This is not the version I personally use as I use the version for Teensy boards but...
    If you use the Arduino version, then you will notice that there are at least two ::begin methods
    Code:
    boolean SDClass::begin(uint8_t csPin) {
      if(root.isOpen()) root.close();
    
      /*
    
        Performs the initialisation required by the sdfatlib library.
    
        Return true if initialization succeeds, false otherwise.
    
       */
      return card.init(SPI_HALF_SPEED, csPin) &&
             volume.init(card) &&
             root.openRoot(volume);
    }
    
    boolean SDClass::begin(uint32_t clock, uint8_t csPin) {
      if(root.isOpen()) root.close();
    
      return card.init(SPI_HALF_SPEED, csPin) &&
             card.setSpiClock(clock) &&
             volume.init(card) &&
             root.openRoot(volume);
    }
    So the question would be did you update the one you are actually calling? Again assuming the garbage code prints out an error message, than I would then make sure to put some comment in every ::begin to see which one (if any) is called.

    Also side note: if it were me, unless I really really wanted to use SDCard... it would probably be a lot easier, just to switch over to using something like the OpenCM904. There are a few issues with the 904C in that they don't have any AX servo connections (xl320 type instead), which can be solved a few different ways. Buy the 904A (no connectors) and the connector kit which has both XL320 and AX servo connector types so you can solder in AX connectors... Or you can simply jumper one of the XL320 connectors to an AX powered hub and then go from there... Or you could use the 904C plugged into the RS485 module which has AX TTL level connectors as well as the RS485 connectors... Probably a lot less hassle!

    On the other hand if it was really just me, would say use a Teensy by PJRC (https://www.pjrc.com/teensy/techspecs.html). If you use the T3.5 or T3.6 they have an SDCard built into them, let alone lots more memory, speed...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) Error uploading arduino program to arbotix card
    By urko_18 in forum Arbotix, Microcontrollers, Arduino
    Replies: 2
    Last Post: 11-21-2017, 09:53 AM
  2. hobby pwm micro servo on Arbotix pro
    By dottuli in forum HR-OS1 Development and Discussion
    Replies: 2
    Last Post: 10-01-2015, 07:37 PM
  3. USB Business Card
    By jdolecki in forum Robotics General Discussion
    Replies: 1
    Last Post: 10-28-2010, 04:12 PM
  4. Question(s) micro servos for a micro hexapod
    By gallamine in forum Humanoids, Walkers & Crawlers
    Replies: 3
    Last Post: 01-23-2010, 01:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •