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.
DMD blinks during network activity on EtherTen
Re: DMD blinks during network activity on EtherTen
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
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
Re: DMD blinks during network activity on EtherTen
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
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
Re: DMD blinks during network activity on EtherTen
Hmmm...dtbaker wrote:however the static text that was on the DMD before the timer was deteched still gets corrupted
Perhaps my network activity is short enough that I don't notice this because my display is fine during the transfer with interrupts off.
Re: DMD blinks during network activity on EtherTen
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 )
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 )
Re: DMD blinks during network activity on EtherTen
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.
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();
}