Page 1 of 1
NNDK Release 2.7.0 - Issues with MOD5282
Posted: Sun Jan 04, 2015 6:56 pm
by ecasey
I have been trying to get Release 2.7.0 working with a MOD5282 on a development board with code that worked properly with Release 2.6.8.
The code now hangs at a call to a system function:
where portnum = 2;
If I comment that function call out, it then hangs at the OSTimeDly(2) (after going through the !dataavail() loop three times ) in this function:
Code: Select all
int ReadCOM(int portnum, int inlen, uchar *inbuf)
{
int x;
while (!dataavail(Comfd[portnum]))
;
OSTimeDly(2);
x = ReadWithTimeout(Comfd[portnum], (char*)inbuf, inlen, 10);
return x;
}
There is no trap; it just hangs, will not AutoUpdate and I have to load a known good s.19 file to get it back to where it will be seen again by NBFind.
Debug fails with the message "connection refused", so it is hard to pin down the problem(s).
I ran the Rebuild All System Files utility successfully, but that did not change the result.
I went back to Release 2.6.8 and the code worked fine, so it is not likely a hardware issue.
Any suggestions as to where to look for solutions would be appreciated.
Ed
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Mon Jan 05, 2015 9:30 am
by dciliske
This gets a What The ... from me. I'm perplexed. We'll investigate this.
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Mon Jan 05, 2015 6:48 pm
by ecasey
Dan,
I tried a simple program on the MOD5282 compiled with Release 2.7.0
Code: Select all
#include "predef.h"
#include <stdio.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <smarttrap.h>
#include <taskmon.h>
#include <NetworkDebug.h>
extern "C" {
void UserMain(void * pd);
}
const char * AppName="DS2480B";
void UserMain(void * pd) {
InitializeStack();
if (EthernetIP == 0) GetDHCPAddress();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();
StartHTTP();
EnableTaskMonitor();
#ifndef _DEBUG
EnableSmartTraps();
#endif
#ifdef _DEBUG
InitializeNetworkGDB_and_Wait();
#endif
iprintf("Application started\n");
while (1) {
iprintf("Hello");
OSTimeDly(80);
}
}
I get "Application started" and one "Hello" and then it hangs.
If I comment out the OSTimeDly(80), I get continuous "Hello"s, but it won't switch tasks, so nothing else works.
Possibly a problem with UCOS.
Ed
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 2:24 pm
by rnixon
Are you running in debug mode or release mode?
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 2:47 pm
by ecasey
I have tried both. Autoupdate doesn't work, so I have to get it back via the serial port.
The same program runs on my MOD54415. I have tried two MOD5282s with the same results.
Are you running a MOD5282 with something compiled on Release 2.7.0?
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 3:45 pm
by rnixon
I just tried your code with my install of 2.7.0, and it is crashing too. Hmmmmm
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 3:58 pm
by ecasey
Yes, I just went back and compiled the factory demo under 2.7.0 for the MOD5282 from the 2.7.0 release examples and it crashed. It looks like something fundamental; the MOD5282 disappears from NBFind and IPSetup doesn't see it after it loads. Then I have to load a known good .s19 from an earlier release via serial to get the MOD5282 to allow an Ethernet update again.
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 4:12 pm
by dciliske
It was a
BSP issue with the Tick Timer... A change that got propagated to all other platforms, except only partially to the MOD5282.
The fix, change lines 56 and 57 from:
Code: Select all
asm(" move.w #0x0F,%d0"); //Reset pit[0] interrupt
asm(" move.w %d0,0x40150001");
to
Code: Select all
asm(" move.b #0x0F,%d0"); //Reset pit[0] interrupt
asm(" move.b %d0,0x40150001");
The previous version was:
Code: Select all
asm(" move.w #0x60F,%d0");
asm(" move.w %d0,0x40150000");
The address got shifted over to match the better value, but not the instruction width. The incorrect instruction made it so that the IRQ flag was never cleared, and therefore that the ISR never triggered, preventing timer based task switching from occurring. It has now been fixed :/
-Dan
Re: NNDK Release 2.7.0 - Issues with MOD5282
Posted: Wed Jan 21, 2015 5:13 pm
by ecasey
Excellent! I tested several of my systems and the fix worked like a charm.
Thanks Dan