Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Error with OctoWS2811 - VideoSDcard

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    5

    Error with OctoWS2811 - VideoSDcard

    hi, i'm tring to compile the example VideoSDcard but i have an error:
    Code:
    Opzioni di compilazione cambiate, ricompilo tutto
    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-openr.o): In function `_open_r':
    openr.c:(.text._open_r+0x10): undefined reference to `_open'
    collect2.exe: error: ld returned 1 exit status
    exit status 1
    Errore durante la compilazione
    i'm using Teensy 3.2,i have try with arduino 1.6.7 with teensyduino 1.27 and 1.6.8 with teensyduino 1.28 beta, but i have the same result
    thx in advice

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,114
    Well, this seems to be a *really* strange bug in these newer versions of Arduino.

    This is going to sound weird, but.... you can work around this problem by opening a new Arduino window. Delete the placeholder code. Then select the entire VideoSDcard example in the first window with CTRL-A, and copy with CTRL-C, and then paste into the new window with CTRL-V.

    The exact same code will compile without error in the newly opened window!

    Definitely a strange bug added in recent versions of Arduino.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,114
    Oh, I see what's happening. These newer versions of Arduino are finding the addaudio program in a subfolder and trying to build it as part of your sketch. Not nice.

    I'll move them to an "extras" folder for the next release.

  4. #4
    Junior Member
    Join Date
    Apr 2014
    Posts
    5
    Hi, many thx for help, its now working, but i think i have some problem whit function leds.show(); in the row 109, the program stay there for very long time(20 min for fps) here the code:
    Code:
    #include <OctoWS2811.h>
    #include <SPI.h>
    #include <SD.h>
    #include <Audio.h>
    #include <Wire.h>
    
    #define LED_WIDTH    137   // number of LEDs horizontally
    #define LED_HEIGHT   16   // number of LEDs vertically (must be multiple of 8)
    
    #define FILENAME     "VIDEO.BIN"
    
    const int ledsPerStrip = LED_WIDTH * LED_HEIGHT / 8;
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    elapsedMicros elapsedSinceLastFrame = 0;
    bool playing = false;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, WS2811_800kHz);
    File videofile;
    
    AudioPlayQueue     audio;
    AudioOutputAnalog  dac;
    AudioConnection    patchCord1(audio, dac);
    
    
    void setup() {
      AudioMemory(40);
      while (!Serial) ;
      delay(50);
      Serial.println("VideoSDcard");
      leds.begin();
      leds.show();
      if (!SD.begin(4)) stopWithErrorMessage("Could not access SD card");
      Serial.println("SD card ok");
      videofile = SD.open(FILENAME, FILE_READ);
      if (!videofile) stopWithErrorMessage("Could not read " FILENAME);
      Serial.println("File opened");
      playing = true;
      elapsedSinceLastFrame = 0;
    }
    
    // read from the SD card, true=ok, false=unable to read
    // the SD library is much faster if all reads are 512 bytes
    // this function lets us easily read any size, but always
    // requests data from the SD library in 512 byte blocks.
    //
    bool sd_card_read(void *ptr, unsigned int len)
    {
      static unsigned char buffer[512];
      static unsigned int bufpos = 0;
      static unsigned int buflen = 0;
      unsigned char *dest = (unsigned char *)ptr;
      unsigned int n;
    
      while (len > 0) {
        if (buflen == 0) {
          n = videofile.read(buffer, 512);
          if (n == 0) return false;    
          buflen = n;
          bufpos = 0;
        }
        unsigned int n = buflen;
        if (n > len) n = len;
        memcpy(dest, buffer + bufpos, n);
        dest += n;
        bufpos += n;
        buflen -= n;
        len -= n;
      }
      return true;
    }
    
    // skip past data from the SD card
    void sd_card_skip(unsigned int len)
    {
      unsigned char buf[256];
    
      while (len > 0) {
        unsigned int n = len;
        if (n > sizeof(buf)) n = sizeof(buf);
        sd_card_read(buf, n);
        len -= n;
      }
    }
    
    
    void loop()
    {
      unsigned char header[5];
    
      if (playing) {
        if (sd_card_read(header, 5)) {
          if (header[0] == '*') {
            // found an image frame
            unsigned int size = (header[1] | (header[2] << 8)) * 3;
            unsigned int usec = header[3] | (header[4] << 8);
            unsigned int readsize = size;
       Serial.printf("v: %u %u", size, usec);
            if (readsize > sizeof(drawingMemory)) {
              readsize = sizeof(drawingMemory);
            }
            if (sd_card_read(drawingMemory, readsize)) {
               Serial.printf(", us = %u", (unsigned int)elapsedSinceLastFrame);
               Serial.println();
              while (elapsedSinceLastFrame < usec) Serial.printf("us = %u", (unsigned int)elapsedSinceLastFrame); ; // wait
              elapsedSinceLastFrame -= usec;
              Serial.print("\nwhile Done");
              leds.show(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// here the program stuck, row 109
              Serial.print("\nShow Done");
            } else {
              error("unable to read video frame data");
              return;
            }
            if (readsize < size) {
              sd_card_skip(size - readsize);
            }
          } else if (header[0] == '%') {
            // found a chunk of audio data
            unsigned int size = (header[1] | (header[2] << 8)) * 2;
             Serial.printf("a: %u", size);
       Serial.println();
      while (size > 0) {
        unsigned int len = size;
        if (len > 256) len = 256;
        int16_t *p = audio.getBuffer();
        if (!sd_card_read(p, len)) {
          error("unable to read audio frame data");
                return;
        }
        if (len < 256) {
                for (int i=len; i < 256; i++) {
                  *((char *)p + i) = 0;  // fill rest of buffer with zero
                }
        }
              audio.playBuffer();
        size -= len;
      }
          } else {
            error("unknown header");
            return;
          }
        } else {
          error("unable to read 5-byte header");
          return;
        }
      } else {
        delay(2000);
        videofile = SD.open(FILENAME, FILE_READ);
        if (videofile) {
          Serial.println("File opened");
          playing = true;
          elapsedSinceLastFrame = 0;
        }
      }
    }
    
    // when any error happens during playback, close the file and restart
    void error(const char *str)
    {
      Serial.print("error: ");
      Serial.println(str);
      videofile.close();
      playing = false;
    }
    
    // when an error happens during setup, give up and print a message
    // to the serial monitor.
    void stopWithErrorMessage(const char *str)
    {
      while (1) {
        Serial.println(str);
        delay(1000);
      }
    }
    and here the serial result:
    Code:
    VideoSDcard
    SD card ok
    File opened
    v: 6576 41666, us = 7808
    , us = 7843, us = 7874, us = 7905, us = 7936, us = 7967, us = 8000, us = 8031, us = 8065, us = 8096, us = 8127, us = 8158, us = 8192, us = 8223, us = 8267, us = 8298, us = 8329, us = 8360, us = 8395, us = 8426, us = 8460, us = 8491, us = 8522, us = 8553, us = 8587, us = 8618, us = 8652, us = 8683, us = 8714, us = 8748, us = 8778, us = 8812, us = 8843, us = 8874, us = 8905, us = 8939, us = 8970, us = 9004, us = 9035, us = 9065, us = 9096, us = 9130, us = 9161, us = 9195, us = 9226, us = 9257, us = 9288, us = 9321, us = 9352, us = 9385, us = 9416, us = 9450, us = 9481, us = 9515, us = 9546, us = 9580, us = 9611, us = 9642, us = 9674, us = 9706, us = 9740, us = 9771, us = 9802, us = 9832, us = 9866, us = 9897, us = 9931, us = 9962, us = 9993, us = 10024, us = 10061, us = 10096, us = 10134, us = 10169, us = 10203, us = 10241, us = 10275, us = 10313, us = 10348, us = 10385, us = 10419, us = 10457, us = 10492, us = 10529, us = 10564, us = 10599, us = 10637, us = 10671, us = 10709, us = 10744, us = 10779, us = 10816, us = 10851, us = 10889, us = 10923, us = 10958, us = 10993, us = 11030, us = 11065, us = 11103, us = 11148, us = 11183, us = 11220, us = 11255, us = 11293, us = 11327, us = 11362, us = 11402, us = 11436, us = 11474, us = 11509, us = 11544, us = 11578, us = 11616, us = 11651, us = 11689, us = 11723, us = 11758, us = 11796, us = 11830, us = 11868, us = 11903, us = 11938, us = 11975, us = 12010, us = 12048, us = 12082, us = 12117, us = 12152, us = 12189, us = 12224, us = 12262, us = 12296, us = 12331, us = 12369, us = 12405, us = 12443, us = 12478, us = 12512, us = 12550, us = 12585, us = 12623, us = 12658, us = 12692, us = 12727, us = 12764, us = 12799, us = 12837, us = 12872, us = 12906, us = 12944, us = 12979, us = 13017, us = 13051, us = 13086, us = 13123, us = 13158, us = 13196, us = 13231, us = 13265, us = 13300, us = 13338, us = 13372, us = 13409, us = 13447, us = 13482, us = 13519, us = 13554, us = 13592, us = 13627, us = 13661, us = 13699, us = 13734, us = 13772, us = 13806, us = 13841, us = 13876, us = 13913, us = 13948, us = 13986, us = 14020, us = 14065, us = 14103, us = 14138, us = 14176, us = 14210, us = 14245, us = 14282, us = 14317, us = 14355, us = 14391, us = 14426, us = 14461, us = 14498, us = 14533, us = 14571, us = 14606, us = 14641, us = 14678, us = 14713, us = 14751, us = 14785, us = 14820, us = 14857, us = 14892, us = 14930, us = 14965, us = 15000, us = 15034, us = 15072, us = 15106, us = 15144, us = 15179, us = 15214, us = 15251, us = 15286, us = 15324, us = 15359, us = 15395, us = 15433, us = 15467, us = 15505, us = 15540, us = 15575, us = 15610, us = 15647, us = 15682, us = 15720, us = 15755, us = 15789, us = 15827, us = 15861, us = 15899, us = 15934, us = 15969, us = 16006, us = 16041, us = 16079, us = 16114, us = 16148, us = 16183, us = 16220, us = 16255, us = 16293, us = 16328, us = 16362, us = 16402, us = 16437, us = 16474, us = 16509, us = 16544, us = 16581, us = 16616, us = 16654, us = 16689, us = 16724, us = 16759, us = 16796, us = 16831, us = 16869, us = 16903, us = 16948, us = 16986, us = 17021, us = 17058, us = 17093, us = 17128, us = 17165, us = 17200, us = 17238, us = 17272, us = 17307, us = 17342, us = 17379, us = 17416, us = 17454, us = 17488, us = 17523, us = 17561, us = 17595, us = 17634, us = 17668, us = 17703, us = 17740, us = 17775, us = 17813, us = 17848, us = 17882, us = 17917, us = 17955, us = 17989, us = 18027, us = 18062, us = 18097, us = 18134, us = 18169, us = 18206, us = 18241, us = 18276, us = 18313, us = 18348, us = 18385, us = 18419, us = 18457, us = 18492, us = 18529, us = 18564, us = 18602, us = 18637, us = 18672, us = 18709, us = 18744, us = 18782, us = 18816, us = 18851, us = 18888, us = 18923, us = 18961, us = 18996, us = 19031, us = 19065, us = 19103, us = 19137, us = 19175, us = 19210, us = 19245, us = 19282, us = 19317, us = 19355, us = 19391, us = 19426, us = 19463, us = 19498, us = 19536, us = 19571, us = 19606, us = 19640, us = 19678, us = 19713, us = 19750, us = 19785, us = 19820, us = 19868, us = 19902, us = 19940, us = 19975, us = 20010, us = 20047, us = 20082, us = 20120, us = 20155, us = 20189, us = 20224, us = 20261, us = 20296, us = 20331, us = 20366, us = 20402, us = 20440, us = 20474, us = 20509, us = 20544, us = 20579, us = 20617, us = 20651, us = 20686, us = 20721, us = 20756, us = 20790, us = 20828, us = 20863, us = 20897, us = 20932, us = 20967, us = 21005, us = 21039, us = 21074, us = 21109, us = 21144, us = 21181, us = 21216, us = 21251, us = 21286, us = 21320, us = 21355, us = 21395, us = 21429, us = 21467, us = 21505, us = 21540, us = 21581, us = 21620, us = 21658, us = 21692, us = 21731, us = 21771, us = 21806, us = 21844, us = 21882, us = 21917, us = 21951, us = 21989, us = 22024, us = 22061, us = 22096, us = 22131, us = 22168, us = 22203, us = 22241, us = 22276, us = 22311, us = 22348, us = 22385, us = 22420, us = 22458, us = 22492, us = 22527, us = 22565, us = 22599, us = 22638, us = 22672, us = 22707, us = 22755, us = 22790, us = 22828, us = 22862, us = 22897, us = 22935, us = 22969, us = 23007, us = 23042, us = 23077, us = 23111, us = 23149, us = 23184, us = 23222, us = 23256, us = 23291, us = 23329, us = 23363, us = 23400, us = 23438, us = 23473, us = 23510, us = 23545, us = 23583, us = 23618, us = 23653, us = 23687, us = 23725, us = 23760, us = 23797, us = 23832, us = 23867, us = 23904, us = 23939, us = 23977, us = 24012, us = 24047, us = 24084, us = 24119, us = 24157, us = 24192, us = 24226, us = 24261, us = 24299, us = 24333, us = 24368, us = 24405, us = 24443, us = 24480, us = 24515, us = 24553, us = 24588, us = 24623, us = 24660, us = 24695, us = 24733, us = 24768, us = 24802, us = 24837, us = 24875, us = 24909, us = 24947, us = 24982, us = 25017, us = 25054, us = 25089, us = 25127, us = 25162, us = 25197, us = 25234, us = 25269, us = 25307, us = 25341, us = 25376, us = 25413, us = 25450, us = 25485, us = 25523, us = 25558, us = 25592, us = 25630, us = 25676, us = 25713, us = 25748, us = 25783, us = 25820, us = 25855, us = 25893, us = 25928, us = 25963, us = 25997, us = 26035, us = 26070, us = 26107, us = 26142, us = 26177, us = 26214, us = 26249, us = 26287, us = 26322, us = 26357, us = 26396, us = 26431, us = 26469, us = 26504, us = 26538, us = 26573, us = 26611, us = 26646, us = 26684, us = 26718, us = 26753, us = 26791, us = 26825, us = 26863, us = 26898, us = 26933, us = 26970, us = 27005, us = 27043, us = 27078, us = 27112, us = 27147, us = 27185, us = 27219, us = 27257, us = 27292, us = 27327, us = 27364, us = 27401, us = 27439, us = 27474, us = 27508, us = 27546, us = 27581, us = 27619, us = 27653, us = 27688, us = 27723, us = 27760, us = 27795, us = 27833, us = 27868, us = 27903, us = 27940, us = 27975, us = 28013, us = 28048, us = 28082, us = 28120, us = 28155, us = 28193, us = 28227, us = 28262, us = 28297, us = 28334, us = 28369, us = 28406, us = 28444, us = 28478, us = 28516, us = 28564, us = 28599, us = 28634, us = 28669, us = 28706, us = 28741, us = 28779, us = 28814, us = 28849, us = 28883, us = 28921, us = 28956, us = 28994, us = 29028, us = 29063, us = 29101, us = 29135, us = 29173, us = 29208, us = 29243, us = 29280, us = 29315, us = 29353, us = 29390, us = 29424, us = 29459, us = 29497, us = 29531, us = 29569, us = 29604, us = 29639, us = 29677, us = 29711, us = 29749, us = 29784, us = 29819, us = 29856, us = 29891, us = 29929, us = 29964, us = 29999, us = 30033, us = 30071, us = 30106, us = 30143, us = 30178, us = 30213, us = 30250, us = 30285, us = 30323, us = 30358, us = 30395, us = 30432, us = 30467, us = 30505, us = 30540, us = 30574, us = 30610, us = 30647, us = 30682, us = 30720, us = 30755, us = 30789, us = 30827, us = 30862, us = 30899, us = 30934, us = 30969, us = 31006, us = 31041, us = 31079, us = 31114, us = 31149, us = 31183, us = 31221, us = 31256, us = 31293, us = 31328, us = 31363, us = 31402, us = 31437, us = 31485, us = 31520, us = 31555, us = 31592, us = 31627, us = 31665, us = 31700, us = 31735, us = 31770, us = 31807, us = 31842, us = 31880, us = 31914, us = 31949, us = 31987, us = 32021, us = 32059, us = 32094, us = 32129, us = 32166, us = 32201, us = 32239, us = 32274, us = 32309, us = 32343, us = 32383, us = 32417, us = 32455, us = 32490, us = 32525, us = 32562, us = 32597, us = 32632, us = 32667, us = 32702, us = 32739, us = 32774, us = 32809, us = 32843, us = 32878, us = 32913, us = 32950, us = 32985, us = 33020, us = 33055, us = 33089, us = 33127, us = 33162, us = 33197, us = 33231, us = 33266, us = 33304, us = 33338, us = 33373, us = 33410, us = 33445, us = 33479, us = 33517, us = 33552, us = 33587, us = 33622, us = 33657, us = 33694, us = 33729, us = 33764, us = 33799, us = 33833, us = 33871, us = 33906, us = 33941, us = 33975, us = 34010, us = 34045, us = 34083, us = 34118, us = 34152, us = 34187, us = 34222, us = 34439, us = 34474, us = 34512, us = 34550, us = 34584, us = 34626, us = 34664, us = 34699, us = 34737, us = 34775, us = 34809, us = 34850, us = 34888, us = 34923, us = 34961, us = 34999, us = 35039, us = 35074, us = 35112, us = 35147, us = 35182, us = 35219, us = 35254, us = 35292, us = 35327, us = 35361, us = 35398, us = 35435, us = 35470, us = 35508, us = 35543, us = 35578, us = 35616, us = 35650, us = 35688, us = 35723, us = 35758, us = 35795, us = 35830, us = 35868, us = 35903, us = 35938, us = 35972, us = 36010, us = 36045, us = 36083, us = 36117, us = 36152, us = 36190, us = 36224, us = 36262, us = 36297, us = 36332, us = 36369, us = 36406, us = 36443, us = 36478, us = 36513, us = 36548, us = 36585, us = 36620, us = 36658, us = 36693, us = 36728, us = 36765, us = 36800, us = 36838, us = 36873, us = 36908, us = 36945, us = 36980, us = 37018, us = 37053, us = 37087, us = 37122, us = 37160, us = 37194, us = 37232, us = 37277, us = 37312, us = 37350, us = 37386, us = 37421, us = 37459, us = 37494, us = 37531, us = 37566, us = 37604, us = 37639, us = 37674, us = 37709, us = 37746, us = 37781, us = 37819, us = 37853, us = 37888, us = 37926, us = 37960, us = 37998, us = 38033, us = 38068, us = 38105, us = 38140, us = 38178, us = 38213, us = 38247, us = 38282, us = 38320, us = 38354, us = 38391, us = 38426, us = 38463, us = 38501, us = 38536, us = 38574, us = 38609, us = 38643, us = 38681, us = 38716, us = 38754, us = 38788, us = 38823, us = 38858, us = 38895, us = 38930, us = 38968, us = 39003, us = 39038, us = 39075, us = 39110, us = 39148, us = 39182, us = 39217, us = 39255, us = 39289, us = 39327, us = 39362, us = 39399, us = 39433, us = 39471, us = 39506, us = 39544, us = 39578, us = 39614, us = 39651, us = 39686, us = 39724, us = 39759, us = 39793, us = 39831, us = 39866, us = 39903, us = 39938, us = 39973, us = 40008, us = 40045, us = 40080, us = 40118, us = 40163, us = 40198, us = 40235, us = 40270, us = 40308, us = 40342, us = 40377, us = 40417, us = 40451, us = 40489, us = 40524, us = 40559, us = 40593, us = 40631, us = 40666, us = 40704, us = 40739, us = 40773, us = 40811, us = 40846, us = 40884, us = 40918, us = 40953, us = 40991, us = 41025, us = 41063, us = 41098, us = 41133, us = 41168, us = 41205, us = 41240, us = 41278, us = 41313, us = 41347, us = 41387, us = 41421, us = 41459, us = 41494, us = 41529, us = 41566, us = 41601, us = 41639
    while Done
    it stay on row 109
    Last edited by monodose; 04-05-2016 at 07:32 PM.

  5. #5
    Junior Member
    Join Date
    Apr 2014
    Posts
    5
    i have try with Videodisplay program and it work fine, maybe is the VIDEO.BIN file the problem? there is a way to test it?

Posting Permissions

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