Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - johnr

Pages: 1 ... 3 4 [5] 6 7
61
Hi Mark, when I disable optimization ,the code size grows to 124K, so
it doesn't fit in the current flash setup. When I set it to level 1
it does fit ,but I still can't set a C level break point in webinterface.c
I did set a C break point in http.c and steped into the webinterface
fnInsertValue() , but it only allows assembly level debugging :(


 John

62
Hi Mark, I did get around the error in VC by including the relative path
to mcf5223_adc.h in config.h, but I then get the following link errors :

application.obj : error LNK2019: unresolved external symbol _fnSendSNMPTrap referenced in function _fnApplication
application.obj : error LNK2019: unresolved external symbol _fnStartSNMP referenced in function _fnApplication
webInterface.obj : error LNK2001: unresolved external symbol _ADC_Chans
M5223X.obj : error LNK2019: unresolved external symbol _fnInit_adc referenced in function _fnInitHW
WinSim.obj : error LNK2001: unresolved external symbol _fnADC
WinSim.obj : error LNK2001: unresolved external symbol _fnSNMP
.\Debug/uTaskerV1-3.exe : fatal error LNK1120: 6 unresolved externals

 I moved the include of mcf5223_adc.h to application.h like you suggested and get the same errors. I specify the following prototypes in mcf5223_adc.h  so I'm not sure why the VC linker is complaining. config.h includes application.h which includes mcf5223_adc.h, so it should be included in all source files, right ?
fnADC is defined in TaskCOnfig.h and is the ADC task handler that gets called every 1 sec in the app.

    mcf5223_adc.h snippet
     .
     .
////////////////////
//   Prototypes
////////////////////

extern void fnInit_adc (void);
extern ADC_Chan ADC_Chans[];
void fnIniInputs(void);


 Our ADC web page will display the values and programming for
8 input channels. We will have columns for dynamic values for
value, max, min etc and programmed values for Input type, Alram Hi and Low limits etc. I will use a drop down box where the user
can select 1 of maybe 15 values for each input types so I figured that
I would need something like

// System defined
 £  - escape lead in
 W - used for lead in type

 // user defined
 X - Input type
 Y - Channel number (1..8)
 Z - Type (TempC, TempF etc)

 I'm assuming the first 2 chars are reserved for the system and the
last 2 are user definable.


 Thanks,
 John




63
Hi Mark, I tried running the project in the simulator, but I get the
following error when I build it :

 .....\utasker\applications\utaskerv1.3\webinterface.c(24) : fatal error C1083: Cannot open include file: 'mcf5223_adc.h': No such file or directory

  'mcf5223_adc.h' is a file I added in CW in the Hardare folder. I tried adding it to the VC Header Files folder with Add|Existing item and I see it in the VC browser, but I still get the error.

The project builds OK under CW.



 Is it possible to pass more than 4 chars with the £xyz tags ? With our app we may run out of chars if we can't. I started looking in http.c etc


 Thanks,
 John

64
 I'm trying to set a breakpoint in fnInsertStrings() to debug my ADC web page that
returns the 8 channels of ADC raw values etc. The code gets executed because I see the
dynamic values displayed on the web page, but the break point I set gets ignored. I can set break points in my adc.c function that handles reading the ADC every 1 sec.


 Thanks,
 John

65
NXPTM M522XX, KINETIS and i.MX RT / Re: SNMP
« on: September 27, 2007, 06:19:18 PM »
Mark, here's the code . It was lines 591 and 593 at the bottom, I have bad eyes

John


// The SNMP Agent listener function
//
static int fnSNMPListner(USOCKET SNMP_socket, unsigned char ucEvent, unsigned char *ucIP, unsigned short usPort, unsigned char *ucData, unsigned short usDataLen)
{
    if (ucEvent == UDP_EVENT_RXDATA) {
        CHAR *cCommunity;
        unsigned char *frame_data = ucData;
        unsigned short usCommunityLength;
        unsigned short usStructureLength;

        if (*ucData++ != ASN1_SEQUENCE) {
            return 0;                                                    // not ANS.1 BER conform - silently ignore
        }
        ucData = fnGetASN1_length(ucData, &usStructureLength);
        if ((!usStructureLength) || (uMemcmp(ucData, ucSNMPV1, sizeof(ucSNMPV1)))) { // check the SNMP version number
            return 0;                                                    // silently discard since we only support V1
        }
        ucData += sizeof(ucSNMPV1);
        if (*ucData++ != ASN1_OCTET_STRING) {                            // community string is expected
            return 0;                                                    // silently ignore if string type not found
        }
        ucData = fnGetASN1_length(ucData, &usCommunityLength);
 ****       cCommunity = (CHAR*)ucData;
        ucData += usCommunityLength;
 ****       if (fnClientListener(SNMP_COMMUNITY_CHECK, (unsigned char*)cCommunity, usCommunityLength) != 0) { // check community

66
NXPTM M522XX, KINETIS and i.MX RT / Re: SNMP
« on: September 27, 2007, 04:41:55 PM »
Thanks Mark, the files were in the stack sub, but had to be manually added to the CW project. I also had to add type casts in snmp.c on lines 291 and 293 to get it to compile with CW 6.3. I was able to send the cold trap out. I also added the pop3 to CW and it compiled ok. The code size is still under 85K !


 John
 

67
NXPTM M522XX, KINETIS and i.MX RT / Re: volatile regs
« on: September 27, 2007, 03:17:26 PM »
Mark, you are correct. I ran the pre-processor on my adc.c and found the volatile
keyword missing from the ADC_POWER reg in m5223x.h. When I brought it up in the
editor I noticed that instead of pointing to my working copy, it pointed to the
original source tree. It was the only file in the project that did not map to my working
tree. When I unzipped the Service pack 5 code, I kept the originals intact and copied
them to a CW project location and made my change there. When I was having a problem where m5223x.h got deactivated from CW by mistake, I deleted it and then
re-added it from the original location instead of the working one :(

 It now works as expected. Thanks for the help. I am learning CW


 John



68
NXPTM M522XX, KINETIS and i.MX RT / SNMP
« on: September 26, 2007, 10:01:59 PM »
Hi , anyone add SNMP traps or agents to the uTasker ? Will this
be available some time  in the future ?

 John

69
NXPTM M522XX, KINETIS and i.MX RT / Re: volatile regs
« on: September 26, 2007, 09:57:09 PM »
Mark, I changed M5223x.h also the same as yours and the compiler
doesn't re read the  ADC_POWER reg in the while loop for some reason
unless I set the global optimization down to 2

 #define ADC_POWER           *(volatile unsigned short *)(ADC_ADD + 0x52)          // ADC Power Control register

  while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS0)
        ;
0001274C: 4A80            tst.l    d0
0001274E: 66FC            bne.s    fnInit_adc+0x44 (0x1274c); 0x0001274c



 John

70
NXPTM M522XX, KINETIS and i.MX RT / Re: volatile regs
« on: September 26, 2007, 07:13:50 PM »
Mark, I posted up the question on the Freescale site and got the following reply which didn't work:

I modified it as follows, but it still didn't work even when the global optimization was lowered to 2.
 
  #pragma opt_loop_invariants off
    // Wait for converter A power up to complete
    while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS0)
        ;
0001274C: 4A80            tst.l    d0
0001274E: 66FC            bne.s    fnInit_adc+0x44 (0x1274c); 0x0001274c
    // Wait for converter B power up to complete
    while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS1)
  #pragma opt_loop_invariants on

  return;
00012750: 028100000800    andi.l   #0x800,d1
00012756: 66000104        bne.w    fnInit_adc+0x14a (0x1285c); 0x0001285c
 

 Here's a copy of my ADC task that ini's the ADC and reads it every
second when the task wakes up. It works with the M52233DEMO
using the pot on AN0.  It operates in the "Triggered parallel mode", scanning all 8 inputs when issued a START0 then stopping.



void fnADC(TTASKTABLE *ptrTaskTable)                            // ADC called regularly
{
 

    MCF_ADC_CTRL1 = START0;   // Start the scan

      while (ADC_ADSTAT & (CIP0 | CIP1)) {} // Wait for any active ADC conversion to complete

    usADC_result[0] = ADC_ADRSLT0 >> 3;                                       // Save the present ADC values (note the order!!)
    usADC_result[1] = ADC_ADRSLT1 >> 3;
    usADC_result[2] = ADC_ADRSLT2 >> 3;
    usADC_result[3] = ADC_ADRSLT3 >> 3;
    usADC_result[4] = ADC_ADRSLT4 >> 3;
    usADC_result[5] = ADC_ADRSLT5 >> 3;
    usADC_result[6] = ADC_ADRSLT6 >> 3;
    usADC_result[7] = ADC_ADRSLT7 >> 3;

      fnDebugMsg("A0=");
      fnDebugDec(usADC_result[0],0,0);
      fnDebugMsg(" A1=");
      fnDebugDec(usADC_result[1],0,0);
      fnDebugMsg(" A2=");
      fnDebugDec(usADC_result[2],0,0);
      fnDebugMsg(" A3=");
      fnDebugDec(usADC_result[3],0,0);
      fnDebugMsg(" A4=");
      fnDebugDec(usADC_result[4],0,0);
      fnDebugMsg(" A5=");
      fnDebugDec(usADC_result[5],0,0);
      fnDebugMsg(" A6=");
      fnDebugDec(usADC_result[6],0,0);
      fnDebugMsg(" A7=");
      fnDebugDec(usADC_result[7],0,0);


      fnDebugMsg("\r\n");

}


/*********************************************************************
* init_adc - Analog-to-Digital Converter (ADC)                       *
**********************************************************************/
void fnInit_adc (void)
{

    // Scan mode = Triggered parallel, converters A and B run simultaneously
    // ADC clock frequency = 5.00 MHz
    // Voltage reference supplied by VDDA and VSSA
    // All ADC interrupts disabled
    // 
    // Sample list for converter A:
    //     Sample 0 : AN0
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 1 : AN1
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 2 : AN2
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 3 : AN3
    //                Low limit = $000, High limit = $FFF, Offset = $000
    // 
    // Sample list for converter B:
    //     Sample 4 : AN4
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 5 : AN5
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 6 : AN6
    //                Low limit = $000, High limit = $FFF, Offset = $000
    //     Sample 7 : AN7
    //                Low limit = $000, High limit = $FFF, Offset = $000

    // Initialise LOLIM, HILIM and OFFST registers of enabled channels:
    MCF_ADC_ADLLMT0 = 0;
    MCF_ADC_ADHLMT0 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS0 = 0;
    MCF_ADC_ADLLMT1 = 0;
    MCF_ADC_ADHLMT1 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS1 = 0;
    MCF_ADC_ADLLMT2 = 0;
    MCF_ADC_ADHLMT2 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS2 = 0;
    MCF_ADC_ADLLMT3 = 0;
    MCF_ADC_ADHLMT3 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS3 = 0;
    MCF_ADC_ADLLMT4 = 0;
    MCF_ADC_ADHLMT4 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS4 = 0;
    MCF_ADC_ADLLMT5 = 0;
    MCF_ADC_ADHLMT5 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS5 = 0;
    MCF_ADC_ADLLMT6 = 0;
    MCF_ADC_ADHLMT6 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS6 = 0;
    MCF_ADC_ADLLMT7 = 0;
    MCF_ADC_ADHLMT7 = MCF_ADC_ADHLMT_HLMT(0xfff);
    MCF_ADC_ADOFS7 = 0;

    // Initialise ADC
    MCF_ADC_ADZCC = 0;
    MCF_ADC_ADLST1 = MCF_ADC_ADLST1_SAMPLE3(0x3) |
                     MCF_ADC_ADLST1_SAMPLE2(0x2) |
                     MCF_ADC_ADLST1_SAMPLE1(0x1);
    MCF_ADC_ADLST2 = MCF_ADC_ADLST2_SAMPLE7(0x7) |
                     MCF_ADC_ADLST2_SAMPLE6(0x6) |
                     MCF_ADC_ADLST2_SAMPLE5(0x5) |
                     MCF_ADC_ADLST2_SAMPLE4(0x4);
    MCF_ADC_ADSDIS = 0;
    MCF_ADC_CAL = 0;
    MCF_ADC_CTRL1 = MCF_ADC_CTRL1_STOP0 |
                    MCF_ADC_CTRL1_SMODE(0x5);
    MCF_ADC_CTRL2 = MCF_ADC_CTRL2_STOP1    |
                    MCF_ADC_CTRL2_SIMULT   |
                    MCF_ADC_CTRL2_DIV(0x2);

    // Power up ADC converter(s) in use
    MCF_ADC_POWER = MCF_ADC_POWER_PUDELAY(0xd) |
                    MCF_ADC_POWER_PD2;

    // Wait for converter A power up to complete
    while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS0)
        ;

    // Wait for converter B power up to complete
    while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS1)
        ;


 PANPAR = 0xff;                      // Enable all ports as ADC inputs


}


71
NXPTM M522XX, KINETIS and i.MX RT / volatile regs
« on: September 25, 2007, 09:13:30 PM »
Hi,
 I started setting up the ADC and I'm using the ini code
genertaed by the Freescale init software that allows you to
plug in some params and it generates the C code to ini various
peripherals. While debugging in mixed view mode I noticed the
line

 // Wait for converter A power up to complete
    while (MCF_ADC_POWER & MCF_ADC_POWER_PSTS0)

would never fall through because the compile was not re reading the
MCF_ADC_POWER reg. I changed the definition to make it volitale

#define ADC_POWER           *(volatile unsigned short *)(ADC_ADD + 0x52)          // ADC Power Control register

but it still wouldn't work. I had to change the CodeWarrior global
optimization from 4, generate smallest code to 2 to get it to
work. I had to remap the M5223x.h files to a new file which uses the
reg naming conventions used by the FreeScale init utility ie

  #define MCF_ADC_POWER              ADC_POWER  etc

I see where various regs in M5223x.h are using the volatile keyword
and it works with full optimization. Why do I have to lower it
to get the ADC loop to work ?


 Thanks,
 John



72
NXPTM M522XX, KINETIS and i.MX RT / Re: Web pages and FTP upload
« on: September 14, 2007, 04:58:29 PM »
 Thanks, Mark, it makes sense now. I modifiled 0menu.htm and made sure it was < 2048 bytes and copyed it up via FTP. When I tried to access 1Lan.htm, I got a 404 error. I then erased all the files via FTP and recopyed them up and everything worked OK. I'll play around with this more. I guess you have to erase the old file before copying over a new one with the same name.

 John

73
NXPTM M522XX, KINETIS and i.MX RT / Re: bare min app link errors
« on: September 13, 2007, 08:32:15 PM »
Thanks Mark, it was user error :( I have 2 copies of uTasker on my PC. The "live"
one runs under VMware, which I want to use for my development work because it's
easily backed up and restored. I initially had problems using USB under VMware so I
installed the development environment on the real drive for testing. Now that it's working
under VMware, I'll delete it to avoid confusion. My main web browser runs on the real drive
so I was uploading an out of date file by mistake !
 Everything looks OK now !


 Thanks,
 John


74
NXPTM M522XX, KINETIS and i.MX RT / Web pages and FTP upload
« on: September 13, 2007, 07:13:24 PM »
 Hi, I uploaded the web pages in the /WebPagesM5223X and everything works OK.
When I uploaded the 5emailsetup page in /alternativepages I noticed it has the same
prefix as admin page, 5. When you click on admin the email setup page overrides the admin page. When I refresh the FTP page in IE I see that all the files are
shortened to 1 char plus an extension, ie 1.HTM b.GIF etc.
 I modified Omenu.HTM, and added a email setup menu link,changed the target to Eemailsetup.htm and renamed 5emailsetup.HTM to Eemailsetup.htm. When I did this I nocticed when I click on the LAN config that the IO config pops up with some uninterpreted text at the top. When I tried uploading the  Eemailsetup.htm it appears that some of the files disappear. I believe the demo project allocates 98K for code and the rest for files and params and each file takes up at least 2K. It seems we can only upload 9 files at a time.


 Thanks,
 John
 

75
NXPTM M522XX, KINETIS and i.MX RT / Re: bare min app link errors
« on: September 13, 2007, 05:10:41 PM »
Thanks Mark, I deleted M5223x.c from the project then added it back and it compiled OK
It was inadvertently set to  N/A code and data size. I'm still learning CW :)
 I built the boot loader project and flashed it in, erasing from 0x0 - 0x7ff. I then built the uTasker-BM project and flashed it in, erasing the flash from 0x800 to 0x17fff to preserve the boot loader, params and file system.
 I was able to boot up and the saved params were intact. I then tested the SW upload
by changing the version in config.h to V1.3 006, compiling and then running BM-convert.bat. The H-upload.bin was 78K. I uploaded it from the web and everything looked OK and it reset within 10 secs. When I refreshed the main screen the Version display was V1.3 000. Also the Device ID defaulted to "uTasker Number 1", not what I set
it. The LAN configs looked ok but the serial baud defaulted to 19.2K.

 When I flashed in the same BM code from CW and reset, the version then displayed properly V1.3 006, the value I set in config.h

 Thanks,
 John


Pages: 1 ... 3 4 [5] 6 7