DMD blinks during network activity on EtherTen

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
dtbaker
Posts: 26
Joined: Sat Jun 02, 2012 12:52 pm

DMD blinks during network activity on EtherTen

Post by dtbaker » Thu Jun 14, 2012 10:16 pm

Anyone notice the DMD blinking when a network operation is occuring?

Is it possible to get around this somehow?

Can post a video if needed.

User avatar
Simon
Posts: 25
Joined: Wed May 02, 2012 2:40 am

Re: DMD blinks during network activity on EtherTen

Post by Simon » Fri Jun 15, 2012 1:26 am

Yes, I have this problem with my DMDs when performing a large-ish Ethernet transfer.

I worked around it by temporarily disabling the Timer1 interrupt before I read or write the Ethernet, then re-enabling it afterwards.

As far as I can tell the Wiznet's SPI activity interferes with the DMD's, and by temporarily preventing the DMD refreshing (by disabling the interrupt) I'm wallpapering over the problem.

I suspect there's a more correct way to solve the problem by fiddling with chip select in the SPI, but I've not delved in to look at it.

[edit]

This was discussed recently:

viewtopic.php?f=4&t=277&p=1568

dtbaker
Posts: 26
Joined: Sat Jun 02, 2012 12:52 pm

Re: DMD blinks during network activity on EtherTen

Post by dtbaker » Fri Jun 15, 2012 2:03 am

Thanks Simon! Have tried putting

Timer1.detachInterrupt( );

just before my

while (client.connected()) {
if (client.available()) {
cr = client.read();

loop. This fixes the blinking display during network operations, however the static text that was on the DMD before the timer was deteched still gets corrupted until I call


Timer1.attachInterrupt( ScanDMD );

after the loop.

I could just keep the DMD blank during network operations but I would prefer to keep it lit up with something useful.

Thanks,
Dave

User avatar
Simon
Posts: 25
Joined: Wed May 02, 2012 2:40 am

Re: DMD blinks during network activity on EtherTen

Post by Simon » Fri Jun 15, 2012 2:22 am

dtbaker wrote:however the static text that was on the DMD before the timer was deteched still gets corrupted
Hmmm...

Perhaps my network activity is short enough that I don't notice this because my display is fine during the transfer with interrupts off.

dtbaker
Posts: 26
Joined: Sat Jun 02, 2012 12:52 pm

Re: DMD blinks during network activity on EtherTen

Post by dtbaker » Fri Jun 15, 2012 6:36 am

I've noticed some improvements after optimising my code that runs after client.read();

Here's the unit I hacked together:

http://codecanyon.net/forums/thread/int ... stem/67311

(can still see a bit of blinking at the start after that $0 displays in the video http://www.youtube.com/watch?v=HBwYJW_38JY )

dtbaker
Posts: 26
Joined: Sat Jun 02, 2012 12:52 pm

Re: DMD blinks during network activity on EtherTen

Post by dtbaker » Sun Jun 17, 2012 9:35 am

My final code that works without any blinking on the DMD looks a bit like this.

The most important thing was running scandmd manually during the network loop.

Code: Select all

void setup() {
  dmd.clearScreen( true );
  dmd.selectFont(Arial_14);
  Timer1.initialize( 4000 );  
  Timer1.attachInterrupt( ScanDMD );  

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    while(true);
  }
  delay(500);
}
void loop(){
  char cr;
  if (client.connect(server, 80)) {
      client.print("GET /foo.html");
      client.println(" HTTP/1.1");
      client.println("Host: google.com");
      client.println("User-Agent: arduino-dtbaker");
      client.println("Connection: close");
      client.println();
      Timer1.detachInterrupt( );  // detach before network operations.
      while (client.connected()) {
        ScanDMD(); // manually refresh dmd display before we read from network
        if (client.available()) {
          cr = client.read();
          // process cr
        }
      }
      Timer1.attachInterrupt( ScanDMD ); // re-attach after network operations
  }else{
   // connection failed.
  }
  delay(100);
  client.stop();
}

Post Reply