FTP upload error OffsetInvalid

I’m developing a few projects with a ConnectMe and NetOS 6.3. I have included the naftpapp so I have a way to upload a new firmware in production modules (the ones without Jtag -C modules).

I haven’t changed the naftpapp, I’m using the original one. But after several versions, when I try to upload a new firmware I get NAFLASH_SECTOROFFSET_INVALID (-7) on the NAFlash_Write.

I’ve been looking through the code, but I didn’t find anything. Th funny thing is that one (A) of the projects was working this morning. After been the whole day with other one (B), I checked if everything kept working but it didn’t. The same error again. But if I upload with Jtag the one I’ve been working (B) and upload (A) via FTP it starts working. ¿?

I don’t understand what the problem is. But it’s like a timebomb in my code. I cannot go to production with this software.

Any ideas where to look?

Thank you very much

Hello again,

I’ve been doing some more research and debug, and these are the new things I found out.

I have the nonworking version, and the working one. If I upload the working one via JTAG, and afterwards via FTP upload the nonworking one the nonworking becomes a working one. And when the FTP writes to Flash, the sectors and offset of the NAFlashWrite are:

4 0
6 0
8 0

But if I upload the nonworking one via JTAG and try to upload via FTP the same firmware the values I get are:

4 0
4 131072

So I get the error InvalidOffset. Why the FTP behaves diferently depending on the way I upload the code? Because it doesn’t calculate the limits properly. 131072 is 128K, and the sectors are 64K so obviusly it should be 6 0 as is in the working one.

Any help please???

Thank you