Ultratronics V1 Pro - SDCard issue - repeatable

Ultratronics Pro V1, various sized SD Cards 2-4-16-32GB, 2GB formatted Fat16, then all formatted Fat32. Arduino 1.6.13 with SAMS 1.6.11 + (repetier variants - not used )

1 off thermistor installed for the bed, 2 off thermocouples installed.  All working correctly without SD Card fitted, when SD Card fitted both thermocouples return 5000 (rather than room temperature)

When I test it with the ultratronictest.ino I get the results once I had moved the SDFat library into the correct place:-

AD values -  T0: 1023 T1: 985 T2: 1023 T3: 1023 T4: 1023
TC values - 1=25.75 2=25.50 3=ERR 4=ERR
SD Card: OK!
AD values -  T0: 1023 T1: 985 T2: 1023 T3: 1023 T4: 1023
TC values - 1=25.75 2=25.50 3=ERR 4=ERR
SD Card: OK!

Showing all is OK (AD1 = Thermistor T1, TC1 /TC2 = Thermocouples).

When I upload the configuration provided by Repetier Configuration v1.0.0dev the file compiles without issue (as long as I use Arduino Due programming port.  If the SDCard is left in the program stops immediately giving a warning in Extruder 1 / 2 (TC1 / TC2 respectively).  If the SDCard is ejected then reset via M999 the thermocouples are stable.  

I have removed the wiring, checked the crimps (however, this is not a new build but an upgrade from a Megatronics v3.0 ) and confirmed it is secure.

The themocouples are on the SPI bus (MAX31855). I had originally installed the latest Arduino 1.8.2 but read on various forums issues with the SDCard library so tried an older more stable version, I uninstalled the Arduino program and deleted the temporary folder.

Any pointers where to start looking to resolve the issue.

EDIT: Think I might have a start as the installed SDFat library was used for the test maybe it has to be used again for the Repetier code...

I require the SDCard as it is where the EEPROM is emulated and I have a dual extruder system that is moved by a servo, with the vales being defined as variables in the EEPROM.

Comments

  • Update:-

    I think I have traced the issue to the HAL.h

    58 // force SdFat to use HAL (whether or not using SW spi
    59 // #undef  SOFTWARE_SPI

    710 #ifdef DUE_SOFTWARE_SPI
        // bitbanging transfer
        // run at ~100KHz (necessary for init)
        static uint8_t spiTransfer(uint8_t b)  // using Mode 0
        {
          for (int bits = 0; bits < 8; bits++) {
            if (b & 0x80) {
              WRITE(MOSI_PIN, HIGH);
            } else {
              WRITE(MOSI_PIN, LOW);
            }
            b <<= 1;

            WRITE(SCK_PIN, HIGH);
            delayMicroseconds(5);

            if (READ(MISO_PIN)) {
              b |= 1;
            }
            WRITE(SCK_PIN, LOW);
            delayMicroseconds(5);
          }
          return b;
        }
        static inline void spiBegin()
        {
          SET_OUTPUT(SDSS);
          WRITE(SDSS, HIGH);
          SET_OUTPUT(SCK_PIN);
          SET_INPUT(MISO_PIN);
          SET_OUTPUT(MOSI_PIN);
        }

        static inline void spiInit(uint8_t spiClock)
        {
          WRITE(SDSS, HIGH);
          WRITE(MOSI_PIN, HIGH);
          WRITE(SCK_PIN, LOW);
        }
        static inline uint8_t spiReceive()
        {
          //WRITE(SDSS, LOW);
          uint8_t b = spiTransfer(0xff);
          //WRITE(SDSS, HIGH);
          return b;
        }
        static inline void spiReadBlock(uint8_t*buf, uint16_t nbyte)
        {
          if (nbyte == 0) return;
          //WRITE(SDSS, LOW);
          for (int i = 0; i < nbyte; i++)
          {
            buf[i] = spiTransfer(0xff);
          }
          //WRITE(SDSS, HIGH);

        }
        static inline void spiSend(uint8_t b) {
          //WRITE(SDSS, LOW);
          uint8_t response = spiTransfer(b);
          //WRITE(SDSS, HIGH);
        }

        static inline void spiSend(const uint8_t* buf , size_t n)
        {
          if (n == 0) return;
         // WRITE(SDSS, LOW);
          for (uint16_t i = 0; i < n; i++) {
            spiTransfer(buf[i]);
          }
          //WRITE(SDSS, HIGH);
        }

        inline __attribute__((always_inline))
        static void spiSendBlock(uint8_t token, const uint8_t* buf)
        {
          //WRITE(SDSS, LOW);
          spiTransfer(token);

          for (uint16_t i = 0; i < 512; i++)
          {
            spiTransfer(buf[i]);
          }
          //WRITE(SDSS, HIGH);
        }

    I can't claim any glory for it as I got a working firmware and started to compare the differences in the sketches (thank you notepad++ and the compare plugin).

    Hopefully this will help someone.


  • I had already copied big parts from ultratronics but had no board for testing. Thanks for showing what needs changed. Added this for next update with the condition of ultratronics board.
  • Thankyou.  If there is anything I do to help let me know.
Sign In or Register to comment.