Hi
In fact there are two things here and the situation is probably not as bad as it seems:
First to the exception in
uEnable_Interrupt(). I have found that this is very sensitive in the LPC23xx project, whereas in others not at all. There is a very simple method to get this to occur in the LPC23xx project - simply put a while loop in
uDisable_Interrupt() after
iInterruptLevel++; (I use about 5000000) and then it happens almost immediately every time there is valid network activity.
I can do the same in a different project and, although the while loop slows things down quite a lot, there is no problem.
After a couple of hours trying to identify what is happening I have not made any progress but the following seems to at least be a work around until the reason can be identified:
if (!iInterruptLevel) {
iInterruptLevel = 1;
// *(int *)0 = 0; // basic error - cause simulator exception
}Rather than generate an exception to signal that something is not operating as expected, it is repaired. All worked well with this - even though it was being 'repaired' a lot (with the delay)!
I suggest trying the work around so that it doesn't disturb any more.
The second point is not really an error. The FLASH in the LPC23xx (which you are using) is a little complicated - see the following for more details:
http://www.utasker.com/forum/index.php?topic=136.0The FLASH granularity is rather large at 32k - not that suitable for a small file system. The uTasker uses a method called sub-files to allows small files to be used. It is a bit complicated since it involves each file being accessible using two different file names. One is a sub-file and one is a complete file, with different write and delete characteristics. It is best to read the following document to learn all of the details:
http://www.utasker.com/docs/STR91XF/FileSystemSTR91X.PDFThe document of not for the LPC23xx but for the STR91. The STR91 has 64k granularity, even larger that the LPC23XX's 32k, but the principle is the same. Also you can see the demo files layout in the documents in
\Applications\uTaskerV1.3\WebPages\WebPagesLPC23xx\FileSystemThe simulator is trying to operate in exactly the same way as the LPC23xx FLASH does. It can not change individual bits within a line (due to a check sum in the FLASH which will otherwise be corrupted - see link above for description) and when writing to lines which are already programmed, the data should be written with only ones (due to otherwise over-stressing the FLASH) - and the simulator is generating an exception (assert) due to the fact that this is taking place and 'could' cause corruption on the target.
The reason why it is taking place has to do with the sub-file system and the bat file which is copying the files via FTP.
The bat file is copying files with their sub-file names. This allows multiple files to be copied to a single FLASH segment (see doc for full details). This works the first time since the FLASH is empty but will fail if repeated due to the fact that some rules are being broken. In fact this will probably work on the target since breaking rules will not always result in corruption and over-stressing the device will not make it fail (immediately).
The way to work is to use the
delete_all.bat to clean the file system and then reload again. This will always work in the simulator (and on the target) since it is not breaking any FLASH programming rules.
When the operation of the sub-file system is understood it is also possible to cause file writes to automatically delete space, but it may mean reloading other files which were sharing the FLASH sector. Therefore it is generally easier to do a full delete.
[In fact if the bat file is written cleverly to cause some files first to be written with their complete file names (to cause sector deletion) and then the others afterwards with their sub-file names it would operate multiple times without breaking rules. But it will be very easy to break it when files are renames so it's not really worth doing this...]
Another tip: The flash content is saved when the simulator is terminated normally. If you want to delete the FLASH content for the next simulation simply delete the file
\Applications\uTaskerV1.3\Simulator\FLASH_LPC23XXXX.iniFinal tip: It is possible to configure to use normal file system operation (not sub-file system) by removing SUB_FILE_SIZE. But this is generally not recommended since it is not very efficient with FLASH memory. It will force every file to occupy at least 32k (one sector) even if it is very small...
Regards
Mark