Rainbowduino V3: Serial communication vs. LED update interrupt


hi all,

i'm trying write firmware rainbowduino v3 board (www.seeedstudio.com/depot/rainbowduino-led-driver-platform-atmega-328-p-371.html) should able stream 25fps via serial connection on build-in usb connection. code streaming 25 8x8 frames per second java application works pretty reliable , stock-firmware of seeedstudio.com (http://www.seeedstudio.com/wiki/rainbowduino_v3.0#resources) takes care of driving 8x8 rgb led matrix works fine.

but if try put both pieces lot of data corruption on serial connection. serial connection runs 115200 baud rate. slowing down 57600 reduces number of data corruptions doesn't solve problem. understanding issues coming conflicts between internal interrupt used arduino serial library , interrupt of stock-firmware setup in following way:

code: [select]

void rainbowduino::init_timer1(void) //initialize timer1 overflow every  100us
{
    tccr1a = 0;                  // clear control register a
    tccr1b = _bv(wgm13);        // set mode phase , frequency correct pwm, stop timer
    icr1 = 10000;                //(xtal * microseconds) / 2000000  1ms cycles
    timsk1 = _bv(toie1);
    tcnt1 = 0;
    tccr1b |= _bv(cs10);
    sei();                      //enable global interrupt
}


each transferred frame gets sliced 4 fragments resulting in 56bytes per fragment (16leds * rgb + 8byte header, footer , crc) resulting in 224bytes per frame , 5600bytes/sec @ 25fps. if enable timer1 updates leds data corruption in each of 56bytes of single frame fragment , maybe ~5-10% of frame fragments i'm losing 1 or more bytes frame fragment length doesn't match.

i'd ask ideas / options approach problem since i'm not expert @ when comes arduinos timers , interrupts. i've played around flexitimer2 library same data corruption results. before trying out more stuff ask myself:

* maybe try archive rainbowduino v3 board (streaming 5600bytes/sec & interrupt triggered every 100us according seeedstudio.com firmware)? fighting against hardware limitations?

* alternative usb serial connection: face same problems if i'd try send 5600bytes/sec via i2c link arduino? wire library use internal interrupt i'll have same problem @ end? haven't worked wire library yet.

any other ideas might solving problem? lot!

greetings,
markus



Arduino Forum > Using Arduino > LEDs and Multiplexing > Rainbowduino V3: Serial communication vs. LED update interrupt


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial