Author Topic: Issue with uTasker on Olimex LPC2478-STK  (Read 29088 times)

Offline RogerH

  • Newbie
  • *
  • Posts: 6
    • View Profile
Issue with uTasker on Olimex LPC2478-STK
« on: September 20, 2009, 04:23:18 AM »
Hi,

I am having problems getting uTasker to run on my Olimex LPC2478-STK board.

On running in the simulator following Marks directions in the NXP LPC2XXX Tutorial all appears to be going well until I get an exception thrown when I try to upload the Webpages via FTP using the DOS Copy_All batch file.

The following exception is thrown at the following code in LPC23XXSim.c when the *(unsigned char *)0 = 0; is executed as it is trying to write to location 0x0000000. "Unhandled exception at 0x00474fe3 in uTaskerV1-4.exe: 0xC0000005: Access violation writing location 0x00000000."

                if (iOldLineBlank == 0) {                                // check that we only write 1 to non-blank lines
                    iLineLength = 0;
                    while (iLineLength < FLASH_LINE_SIZE) {
                        if (ucNewLine[iLineLength++] != 0xff) {
                            *(unsigned char *)0 = 0;                     // writing non '1' to a non-blank line - signal so that this can be corrected
                        }
                    }
                }

Why is this code writing to memory location 0. The comment is suggesting that this is to signal an error so that it can be corrected later.

Any assistance here would be gratefully received.

Many thanks, RogerH



Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #1 on: September 20, 2009, 12:40:31 PM »
Hi Roger

The memory in the LPC2xxx tends to have a large granularity (eg. 32k). This is not always very practical (other devices have typically 512 byte, 1k or 2k granularity) for the file system since a single file, however small, occupies a compete 32k block. The work-around to this is to activate "sub-file system" support [activated by default in the LPC2XXX project]. This is described in the following document: http://www.utasker.com/docs/STR91XF/FileSystemSTR91X.PDF (not for the LPC2XXX specifically but the same technique).

Sub-file system use allows multiple small files to share one single FLASH sector. Its use is however a bit more complicated since it not not always possible to delete one single file. It is also not always possible to update a single sub-file without first deleting a complete sector.

The LPC2XXX FLASH is also a bit special in how it is internally organized and how it works. For example, it has a check sum for each line of 16 bytes as described in the following: http://www.utasker.com/forum/index.php?topic=136.0, which points to the best explanation of internal workings ever found, by Philips Apps on the Yahoo forum!

The FLASH programming rules mean that one has to be very careful to not cause any changes to an existing 16 byte line since, although the change may be correctly made, the line's internal check sum is corrupted and so the chip reads back incorrect data.

What the simulator is telling you is that you have performed something which has not respected a FLASH programming rule. (The target will not cause an exception but instead may have corrupted FLASH content after doing this and so could behave strangely). Usually this occurs when trying to upload a new file to a sub-file space without first deleting the sector - this is basically not allowed by the FLASH controller in the chip.

If you initially perform a delete (eg. DEL *.* via FTP) it will clear all FLASH file-system content and then you should never have such a problem. Once you understand the internal workings (after reading the sub-file system document) you will then be able to decide when overwriting files is possible and when it is first necessary to perform a delete of an area to be copied to.

Regards

Mark

Offline RogerH

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #2 on: September 21, 2009, 08:10:13 AM »
Hi Mark,

That did the trick! Now why didnt I think of doing that. I was also uploading the wrong set of pages which wouldn't have helped.

I now am able to browse all pages and change configuration except the upload image to TFT is not working. The image uplopaded does not appear on either the web page or the hardware. I will try to debug this further.

Thanks heaps for your assistance.

Cheers, Roger...


 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #3 on: September 21, 2009, 12:01:05 PM »
Hi Roger

If an attempt is made to upload an image in the wrong format or over-sized it will be rejected (it must be 24 bit color BMP and the same size/or smaller than the display). I believe that, once an image has been rejected, no further images can be loaded - this is not intended and is probably a bug (only after the bad attempt) which could be improved.

Since it is neither working in the simulator nor on the target there must be an explanation for it. Also make sure that the TFT support is activated (in config.h), although it should automatically be the case.

Regards

Mark

Offline RogerH

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #4 on: September 23, 2009, 10:49:07 AM »
Hi Mark,

Resolved with some embarrasement on my side :-)

SUPPORT_TFT was defined, but I had commented out the #define SUPPORT_GLCD at some point in my debugging.

Only slight issue remaining is the one shot only at presenting the TFT image on the webpage.

Many thanks for your assistance with this.

Cheers, Roger...

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #5 on: June 04, 2010, 01:38:25 AM »
I'm not sure if this is the same issue, but...

I'm running the simulator only for the LPC2478-STK and the TFT does not display images posted to it.
The broken link image is all that is displayed.  My guess is the BMP file is not being posted to the correct memory.

I commented out the following to get the web pages to display
//#define FTP_UTFAT                                      // allow FTP to work with utFAT
//#define HTTP_UTFAT                                    // allow HTTP to work with utFAT


#define SUPPORT_TFT is defined by default and builds with no errors

If I define define SUPPORT_GLCD, I get 576 errors
#define SUPPORT_GLCD
uTasker - 576 error(s), 10 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


-Kevin



Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #6 on: June 04, 2010, 02:12:43 AM »
Additional info, I get no errors but the following warning
TFT.c
c:\documents and settings\kevin\my documents\downloads\development\utasker\utaskerv1.4_lpc\applications\utaskerv1.4\tft.c(406) : warning C4244: 'initializing' : conversion from 'unsigned long' to 'unsigned short', possible loss of data


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #7 on: June 04, 2010, 01:49:28 PM »
Hi Kevin

To run the simulator for this board and TFT check that the settings are as follows (in config.h)

#define LPC2478FET208 (this will automatically activate TFT and the Olimex board)

//#define SUPPORT_GLCD (note that this needs to be off)

That should be all that is required to get the simulator displaying the TFT (it is black when when running but no image loaded yet).
Then the uploaded image should appear in the simulator when posted on the web page and the web page update with the image too.

Regards

Mark


P.S. When #define SUPPORT_GLCD is enabled make sure that other sub-settings are disabled:

  //#define OLED_GLCD_MODE                                               // use an OLED in GLCD compatible mode
  //#define TFT_GLCD_MODE                                                // use a TFT in GLCD compatible mode
  //#define NOKIA_GLCD_MODE                                              // use Nokia 6100 LCD in compatible mode
  //#define CGLCD_GLCD_MODE                                              // use colour LCD in GLCD compatible mode


Then you should see a blue graphical LCD appear instead of the TFT and it will run a demo without need to load images.

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #8 on: June 05, 2010, 10:28:05 PM »
Mark-

When I run the demo file from the website on the real HW, the TFT page displays a black box (prior to an image upload)

When I run the simulator, I get a broken link icon instead of the black box.

Do I have to enable external SDRAM in the source code?

I'm going to start from scratch and see what happens.

-Kevin
« Last Edit: June 05, 2010, 10:52:53 PM by Kevin »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #9 on: June 06, 2010, 12:36:57 AM »
Hi Kevin

I just took the latest release, disabled LPC2378FBD144 and enabled LPC2478FBD208 and that was all to get the black TFT displaying in the simulator (not yet on the web site).

I also disabled SDCARD_SUPPORT to be sure that it couldn't disturb (shouldn't normally since it defaults to internal file system).

After loading the web pages from \Applications\uTaskerV1.4\WebPages\WebPagesLPC23xx\WebPagesLPC24XX I repeated your test and can confirm the problem. It is due to the fact that the support is not included in the last release for the TFT but it can be modified very easily to work by doing the following:

1) In webInterface.c. At every conditional define for SUPPORT_GLCD add also || defined SUPPORT_TFT {4 locations if I counted correctly}

2) In app_user_files.h. At every conditional define for SUPPORT_GLCD add also || defined SUPPORT_TFT {2 locations}

Generally the new conditional lines look like (for reference):
#if defined SUPPORT_GLCD || defined SUPPORT_OLED || defined SUPPORT_TFT

This adds the necessary dynamic web content generation for the TFT. My mistake - I didn't realise that this was not active in the last release because it was in my development version, which was used for the binary.

I am quite sure it will work then for you too.

Good luck.

Regards

Mark





Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Issue with uTasker on Olimex LPC2478-STK
« Reply #10 on: June 08, 2010, 01:53:19 AM »
That worked!

Thanks Mark!

-Kevin