Author Topic: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error  (Read 14453 times)

0 Members and 1 Guest are viewing this topic.

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« on: June 13, 2017, 11:48:36 am »
I have downloaded the Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader_v3_2_0 . After reading the documentation I could successfully upload the bootloader.The MCU is avr-atmega256rfr2.The fuse bits we used are FF,9C,62(as specified in the documentation).After that, i converted the Bitcloud application code in ".elf" to ".srec" .Then I tried to upload the application code using boot loader PC tool.At this time it shows to reset the device.We reset it.After some seconds the PC bootloader raises an error showing  "Node cannot be programmed.Exceed try count" ..I tried the same thing through command prompt.What will be the issue?please help.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #1 on: June 13, 2017, 05:39:16 pm »
This bootloader is very old and not really maintained. Do you have to use it? If not - use something else. I doubt anyone here will be able to help you, you will have to debug this stuff yourself.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #2 on: June 14, 2017, 03:03:07 am »
I need a bootloader to upload the bitcloud application code and don't want to necessarily use this one.Are there any other Atmel's bootloader for supporting avr-atmega256rfrMCU?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #3 on: June 14, 2017, 03:05:45 am »
There is one in LwMesh package, for example. But ATmega's are very annoying in a way it supports bootloaders, so if you specifically need BitCloud support, then you better off just debugging that one.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #4 on: June 14, 2017, 03:12:49 am »
We are also using Lwmesh_1_2_1 ..In which directory of Lwmesh the bootloader resides?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #5 on: June 14, 2017, 03:20:23 am »
Bootloader got removed from v1.2. Here is v1.1.1, and bl is still there. https://www.dropbox.com/s/qoft7d1kavu6u00/lightweight_mesh_stack_v1.1.1.zip?dl=0

But it will not work with BitCloud. BitCloud will want flash access functions to make PDS work, and it will expect them located in a specific way.

Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #6 on: June 14, 2017, 03:26:38 am »
Thank you so much ataradov.We dont need to necessarily burn bitcloud.Lwmesh is enough.We haven't seen any documentation for how to use this bootloader.
« Last Edit: June 14, 2017, 03:29:58 am by vishal »
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #7 on: June 14, 2017, 01:10:46 pm »
I referred
http://www.avrfreaks.net/forum/lightweight-mesh-otau
http://www.avrfreaks.net/sites/default/files/OTA%20Upgrade%20Guide.pdf.
Added support for avr-atmega256rfr2MCU(linker).I could compile the bootloader.c file for avr-atmega256rfr2.Then I uploaded the bootloader image with fuse bits FF,1C,E2.After that I tried to load WSNDemo.elf file using the command 
python otaServerDemo.py -d -p COM4 -a 0x8555 -t 0x0010 WSNDemo.elf.
But I am getting the following error:

Port            : COM4
Baudrate     : 38400
Server        : 0x8555
Client         : 0x0010
PAN ID       : 0x1234
Channel      : 15 (0x0f)
Firmware     : WSNDemo.elf
Firmware size: 1483276 bytes
-> UART_COMMAND_COMM_CHECK
Error:response timeout.
What will be the reason for it?please help
« Last Edit: June 14, 2017, 01:20:27 pm by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #8 on: June 14, 2017, 04:58:26 pm »
What are you trying to do?  This is an OTA server, not a bootloader utility. It also takes raw binary files, not ELF files.

There is no script for the bootloader itself, it uses Xmodem protocol, so any terminal program that can send files over Xmodem will upload a file (again, raw binary only).
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #9 on: June 15, 2017, 04:27:05 am »
Thanks .After loading the bootloader I tried to load a WSNDemo.bin file using an extraPutty terminal which supports Xmodem protocol.But I couldn't upload the image.I read that
Quote
To enter bootloader mode power on/reset the board while holding button down (the only
button in case of RCB and SW1 in case of MeshBean). Terminal emulator should receive
capital letter ā€œCā€ every second.
I reset the device before sending file from extraPutty.But when I click send button the terminal waits for some time and exit.I am attaching the bootloader code of the atmega256rfr2 image.Why it happens so?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #10 on: June 15, 2017, 04:35:54 am »
Do you see letters 'C' in a terminal? That's the first step to debugging.

I really don't know off the top of my head. AVR is a really bad architecture for devices with large memory size. I switched to ARM and now my life is good again.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #11 on: June 15, 2017, 04:38:56 am »
Do you see letters 'C' in a terminal? That's the first step to debugging.
I am not getting letters 'C' .  :'( .  I reset the device after connecting the device to serial terminal and before sending file.Is that correct.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #12 on: June 15, 2017, 04:41:21 am »
Your code indicates PE0 as a boot entry pin. You need to pull that low and reset the device. This will requires a bootloader, and it will start sending letters 'C'. No need for any further resets.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #13 on: August 25, 2017, 11:55:17 am »
Hi ,I could successfully uploaded the booloader.After that I tried to load application.For this I compiled WSNDemo application for a coordinator and loaded WSNDemo.bin using ExtraPutty with Xmodem protocol.No error has shown while loading the application.But When I tried to connect it to a serial terminal its only showing 'C'.We expected to display the coordinator name as "coordinator."Why it happens so.please reply.I am using avr-atmega256rfr2MCU The Code bootloader.c and Makefile also attached
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #14 on: August 25, 2017, 06:13:34 pm »
You are clearly still in bootloader mode, check that your boot entry condition is false after image upload. Also read out the resulting image and see if anything was written into the flash. Basically debug your stuff, I can't do that remotely.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #15 on: August 26, 2017, 04:11:18 am »
Hi,I debug it and i could see that the booloader entry section is has not become false after WSNDemo.bin upload.since I chnaged the code from 128rfr1 to 256rfr2 i am confused wther any buffer or configuration is missing for it.Thats why I attached the files too.
The section 
Code: [Select]
if (0 == (status & ((1 << FE1) | (1 << DOR1) | (1 << UPE1)))){

      return true;
}
returns true .but after that any of the condition in
Code: [Select]

if (XMODEM_EOT == buf[0])
      {
        timeout = 0;
        handle_buffer();
        send(XMODEM_ACK);
        return;
      }
    }

     
    if (0 == ptr)
      continue;

    crc = get_crc();

    if (XMODEM_SOH == buf[0] && (uint8_t)seq == buf[1] && 0xff == (buf[1] + buf[2]) &&
        (buf[131] == (uint8_t)(crc >> 8)) && (buf[132] == (uint8_t)(crc)))
    {
      handle_buffer();
      seq++;
      send(XMODEM_ACK);
    }
    else
    {
      flush();
      send(XMODEM_NAK);
    }

not working.Simply returns to bootloader mode again.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #16 on: August 26, 2017, 04:14:17 am »
Entry section is sampling of the external pin. The code you shown here is just a part of the Xmodem protocol that has noting to do with entry.

Jut remove your active entry signal from the pin.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #17 on: August 26, 2017, 05:05:52 am »
We removed the active entry signal on PE0 after images is uploaded and it exit from the bootloader mode.But it does not start the application.What may be the mistake with us.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #18 on: August 26, 2017, 05:34:31 am »
Have you checked that application was actually uploaded? Read out the device flash, and compare with what you have actually tried to upload.

There are only 2 ways bootloader can run - though explicit request or as a fall-trough if there is no application.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #19 on: August 26, 2017, 07:33:52 am »
Have you checked that application was actually uploaded? Read out the device flash, and compare with what you have actually tried to upload.
I read out the device flash, the application was not uploaded successfully.But when i upload the code extra putty is not showing any error.What will the reason for this upload failure.Anyhow, I am debugging the code.But little confused whether it's because of hardware issue or bootloader issue.I tested  the same application without bootloader and it worked
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #20 on: August 26, 2017, 09:02:37 am »
This clearly has nothing to do with the application, since bootloader fails to write received data into the flash. You need to debug that. Just manually call write_page()  and see if does anything. And tweak it until it does.

It may be related to EIND usage. I really don't remember any of this, I moved on to sane architectures, and it has been a long time since I did anything with AVR.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #21 on: August 29, 2017, 10:15:00 am »
This clearly has nothing to do with the application, since bootloader fails to write received data into the flash. You need to debug that. Just manually call write_page()  and see if does anything. And tweak it until it does.
Sorry to disturb you again.I called write_page(addr,buf) from the main.But nothing has happened.The fuses i used are FE,1C,E2. Is it may be because of any configuration error?
I am debugging it.Surely i will try my best to solve it.Since the code is copied from avr-atmega128rfa1 little bit confused wther there any configuration has missed or not?
Quote
It may be related to EIND usage. I really don't remember any of this, I moved on to sane architectures, and it has been a long time since I did anything with AVR.
I main i set EIND=1 on entry  and EIND=0 on exit just before starting the application
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #22 on: August 29, 2017, 11:20:55 am »
If you want help, decode fuse settings, I have no idea what those numbers mean in human language.

You should probably try examples from avr-libc and see if they work. Comment out all the Xmodem stuff and just make sure you can write a single page.

I really have no idea and without trying on a real hardware, I would not be able to tell what is wrong. And I don't have any real m256RFR2 hardware or programmers at the moment.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #23 on: August 29, 2017, 11:51:32 am »
If you want help, decode fuse settings, I have no idea what those numbers mean in human language.
Code: [Select]
BODLEVEL  - 1 v8
OCDEN       - Enable
JAGEN        - Enable
SPIEN        -  Enable
WDTON     -  Disable
EESAVE      - Disable
BOOTSZ     -  1024w-1FC00
BOOTRST   -  Enable
CKDIV8     -  Disable
Ckout       -   Disable
CKSEl-SVT - INTRCOSL-6CK-65Ms
These are the fuse settings

Quote
You should probably try examples from avr-libc and see if they work. Comment out all the Xmodem stuff and just make sure you can write a single page.
I will try this.
Also I strated the work by refering this link

[url]http://www.avrfreaks.net/forum/lightweight-mesh-otau]http://www.avrfreaks.net/forum/lightweight-mesh-otau]
[url]http://www.avrfreaks.net/forum/lightweight-mesh-otau

[/url]
« Last Edit: August 29, 2017, 11:53:10 am by vishal »
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #24 on: August 30, 2017, 04:03:59 am »
It Worked  :) .In linker script i had written
Code: [Select]
MEMORY
{
 text   (rx)  :  ORIGIN=0x00000000, LENGTH =256K-2K
 boot   (rx)  : ORIGIN=0x0003f800,  LENGTH=2K
 data   (rw!x): ORIGIN=0x00800190,LENGTH=32K-500
}
Then I modified this with following
Code: [Select]
MEMORY
{
  text  (rx)  : ORIGIN = 0x0003f800,LENGTH=2K
  boot (rx)   : ORIGIN=0x0003fffc,LENGTH=4
  data  (rw!x) : ORIGIN=0x00800190,LENGTH=16K-500
}

With this It worked.I could load the application with bootloader.
Noow I am trying to work on over the air upgrade.What are the necessary changes to make it work for avr-atmega256rfr2 rcb.I found it has only support for atmega128.Can I adopt the same withmodification for avr-atmega256rfr2?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #25 on: August 30, 2017, 04:30:59 am »
If we are talking about LwMesh OTA, then no changes should be necessary as far as I remember. It will take any file you give it.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #26 on: August 30, 2017, 04:52:22 am »
If we are talking about LwMesh OTA, then no changes should be necessary as far as I remember. It will take any file you give it.
yes the same .
I have woked OTA but am getting the following error
->UART_COMMAND_COMM_CHECK
Error:response timeout.
Why it so?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #27 on: August 30, 2017, 05:10:17 am »
Are you running OTA server application? Check your serial port connections.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #28 on: August 30, 2017, 05:26:12 am »
Are you running OTA server application? Check your serial port connections.
yes I am running OTA Server application.After connecting the OTAServer board to COM port I run the following
python otaServerDemo.py -d -p COM2 -i 0x1234 -c 15 -a 0x8555 -t 0x0000 C:\Users\demo\LwMesh_1_1_1\apps\WSNDemo\make\Debug\WSNDemo.bin
.But i am getting "response time out error".I have chnged makefile for avr-atmgega256rfr2 and it compiled.Do I need to specify anythng for avr-atmgega256rfr2 in any of the configuration
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #29 on: August 30, 2017, 05:34:53 am »
You need to debug the whole system and figure out why Python commands are not getting into the OTAServer application and/or why it is not responding.

Put a breakpoint in the UART receive callback and check that your command is getting to the application.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #30 on: August 30, 2017, 12:46:07 pm »
Hi
I could successfully sent file .I got message
OTA_UPGRADE_COMPLETE_STATUS
block sent
file sent
.....But the modified code hasn't restarted in the other device.What will be the reason.I used same fuse settings for otaServer and otaClient.Also clock freaquency is 8000000.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #31 on: August 30, 2017, 01:08:34 pm »
OTA Server is just an application, it does not need to boot from the bootloader, if you don't actually have a bootloader.

First of all check that file is actually received and saved. New image is stored at the offset defined by STARTING_ADDRESS = (SYS_DEVICE_SIZE / 2).

Also check that SYS_DEVICE_SIZE is defined correctly, but things would not really work this far if it was not.

If image is stored in the flash, then check that appSwitch(); gets called.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #32 on: August 30, 2017, 01:22:59 pm »
OTA Server is just an application, it does not need to boot from the bootloader, if you don't actually have a bootloader.
I used this to transfer the file not added with bootloader.I run this as a seperate application
Quote
Also check that SYS_DEVICE_SIZE is defined correctly, but things would not really work this far if it was not.
I defined the following
Code: [Select]

#define SYS_DEVICE_SIZE        262144
#define SYS_PAGE_SIZE          256
#define SYS_BOOTLOADER_SIZE    2048

 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #33 on: August 31, 2017, 10:13:22 am »
If image is stored in the flash, then check that appSwitch(); gets called.

yes the appSwitch() is gets called.but it doesnot start the new application.I defined the SYS_DEVICE_SIZE to value 262144.Is it because of iap_address error.If So what else value can i define.please help
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #34 on: August 31, 2017, 11:20:39 am »
The device size value is correct, but those 4 bytes reserved at the end are for pointers, and this is not enough for storing 2 pointers for a 256k device.

Can you send a flash image with received image (after the upload is done)?

I'm not sure how your image is written with truncated pointers like that.

In general, iapswitch does nothing by itself, it just jumps up the bootloader, which does  the actual work. You need to trace execution there.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #35 on: September 01, 2017, 06:13:14 am »
I am debugging the code.Will send the flash image after that.
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #36 on: September 15, 2017, 08:00:36 am »
Hi.I couldn't get it success.while debugging i could see that the appSwitch() is get called.but from there the fuction  iap_switch_handler(); hasn't called.The otainterface file is attached with this .please check if anythng needed to add.The flas image of the device also attached.
« Last Edit: September 15, 2017, 08:05:46 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #37 on: September 15, 2017, 08:06:48 am »
As I said earlier, it is related to the fact that .boot.write_page and .boot.switch are 2 bytes long, and they need to be 4 bytes long. And you many need to mess with EIND when calling them as well. AVR past 128K is really messy and stupid.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #38 on: September 15, 2017, 08:13:51 am »
As I said earlier, it is related to the fact that .boot.write_page and .boot.switch are 2 bytes long, and they need to be 4 bytes long. And you many need to mess with EIND when calling them as well. AVR past 128K is really messy and stupid.
Sorry to ask.Where can I mention the .boot.write_page and .boot.switch.i havent seen any place othar than this
Code: [Select]

__attribute__((section(".boot.write_page"))) void iap_write_page_handler(uint32_t addr, uint16_t *buf);
__attribute__((section(".boot.switch"))) void iap_switch_handler(void);

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #39 on: September 15, 2017, 08:14:46 am »
In the linker script on both application and bootloader side.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #40 on: September 15, 2017, 08:21:50 am »
This is my linker script.can you please help me to set this value in this file
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #41 on: September 15, 2017, 08:26:22 am »
So their size is defined by the natural size of the pointer for that platform. And I don't know if it is 2 or 4 bytes - look in the binary.

Also just step though that code calling the switch function in the disassembly mode and check what exactly it is doing and how to fix it to do the right thing.

I really don't know/remember without doing all of this myself. And I'm not going to do that, I moved from AVRs for good and have no desire to touch them ever again.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #42 on: September 15, 2017, 09:10:12 am »
Can We assign this in the linker itself without refering the natural size.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #43 on: September 15, 2017, 09:11:48 am »
The problem is that if size is 2, then you need to manually manage EIND no matter what. There is only one way to know - run it under the debugger and see what is going wrong.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #44 on: September 16, 2017, 08:57:53 am »
I debug the code and I could see that all call to all function working correctly.But the new application is not restarted in the device.I know u are not working in avr now.why the new application is not started in address specified is still unknown.Am not getting any error .The code works fully without any trouble. It may be because of the size issue .I have changed the those size values to some large.but no use.I am really stuck in updating the firmware.Please help me to fix it
« Last Edit: September 16, 2017, 09:00:17 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #45 on: September 16, 2017, 02:49:07 pm »
I debug the code and I could see that all call to all function working correctly.
So do you end up in the bootloader after the switch called in the application?

Can you send me a device memory dump after the upgrade (even failed one)?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #46 on: September 19, 2017, 04:21:17 am »

Can you send me a device memory dump after the upgrade (even failed one)?
am attaching the device memory dump.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #47 on: September 19, 2017, 04:23:03 am »
That's a very short dump consisting of all 0xff.

Yes, it is 8K, so it look like a dump of the EEPROM. I need the dump of the flash memory (all 256K).
« Last Edit: September 19, 2017, 04:28:53 am by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #48 on: September 19, 2017, 04:34:02 am »
Here is the device flash image.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #49 on: September 19, 2017, 04:39:14 am »
This file has no second image, so your write function does not work either (to be expected, really).

You need to figure out that mechanism, where application must call a function located in the bootloader. This is a key thing here, and no matter what you do, you won't be able to avoid debugging it.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #50 on: September 19, 2017, 06:03:06 am »
Hi,The status message after the file transfer is attached .I couldnt see any function  in the application which calls the bootloader.c file.All those OTA upgrade only has dependency to OTAClient.c and OTAInterface.c.Also,the write page fucntions written in OTAInterface.Is that enough for the fucntioning?
« Last Edit: September 19, 2017, 06:07:27 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #51 on: September 19, 2017, 06:11:36 am »
It does not matter what that script says at this point.

OTA interface contains calls to two functions located in the bootloader - IAP_WRITE_PAGE_HANDLER and IAP_SWITCH_HANDLER. appGetIapHandler() is used to retrieve actual pointers. The problem is that it only reads words, which is enough on 128K devices, and not enough on 256K devices.

You need to figure out if standard C pointer is 2 or 4 bytes on that platform.

Basically forget about full OTA stuff for now. Just call appSwitch() anywhere from the application, and make things work so that iap_switch_handler() is called in the bootloader. Just called, it does not have to actually do anything, just blink an LED or something.

Once that works, the rest will work automatically.

It is a pretty short path in assembly, you should be able to easily trace it. If you can't, you should consider hiring someone to do this.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #52 on: September 19, 2017, 09:10:43 am »
Basically forget about full OTA stuff for now. Just call appSwitch() anywhere from the application, and make things work so that iap_switch_handler() is called in the bootloader. Just called, it does not have to actually do anything, just blink an LED or something.

Once that works, the rest will work automatically.
appSwitch () and iap_switch_handler() is working..No doubt in it.If it works then why the application not restarted?

Quote

OTA interface contains calls to two functions located in the bootloader - IAP_WRITE_PAGE_HANDLER and IAP_SWITCH_HANDLER. appGetIapHandler() is used to retrieve actual pointers. The problem is that it only reads words, which is enough on 128K devices, and not enough on 256K devices.
appGetIapHandler() didnt see in any of the file
Quote
You need to figure out if standard C pointer is 2 or 4 bytes on that platform.
This one i am confused.Where it is specified as 2 or 4 byte.
« Last Edit: September 19, 2017, 09:12:29 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #53 on: September 19, 2017, 09:13:26 am »
appSwitch () and iap_switch_handler() is working..No doubt in it.
Can you elaborate how do you know it? I don't see how it can work with your current code.

appGetIapHandler() didnt see in any of the file
It is the first function in the otaInterface.c file.

This one i am confused.Where it is specified as 2 or 4 byte.
Either compiler documentation or experiment.
« Last Edit: September 19, 2017, 09:15:35 am by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #54 on: September 19, 2017, 09:28:45 am »
It is the first function in the otaInterface.c file.
Please have a look at following otaInterface.Am using otainterface for atmega256 device.Am attaching both 128 and 256 otaInterface file.and am working on otaInterface for avr256.In that the function is missing.Can you check wthethr the file am using is correct or not

 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #55 on: September 19, 2017, 04:24:38 pm »
That is not how those files look in the latest stack version to include OTA.

I'm not sure where yours came from, I can't see a single version where it was like this.
« Last Edit: September 19, 2017, 04:26:32 pm by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #56 on: September 20, 2017, 03:14:03 am »
That is not how those files look in the latest stack version to include OTA.
Where Can I get the latest version.I have worked on LwMesh_1_1_1 and LwMesh_1_2_1 and bootloader is provided with LwMesh_1_1_1 .and I got otaInterface.c file for avr-atmega256 from the following reference
http://www.avrfreaks.net/comment/925251#comment-925251
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #57 on: September 20, 2017, 03:22:09 am »
LwMesh_1_1_1 contains the file I included. It is also your 128K file.

The thing is, both files are correct for both cases. Either of them will work, but you need to match what bootloader provides and what application expects. And standard bootloader is designed for the 128K style. You either need to change your application or bootloader.

You really need to understand how all this works. You can't make it work by pulling random bits form the internet.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #58 on: September 20, 2017, 04:03:01 am »
My understanding is if we use default boot loader and application we should need to
1)program the bootloader
2)transfer the application using serial port
3)then further application modification is done via OTA using otaServer.
But what are the steps to follow if the booloader function is inclued in application itself.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #59 on: September 20, 2017, 04:06:26 am »
It is not about the steps. It is about how application talks to the bootloader.

You need to figure out a way to place a function that blinks an LED in the bootloader section and call that function from the application. However you do that is not important.

In the second option (your 256K file), function are located at fixed addresses. You still need a "bootloader" that contains those functions. There is no serial port stuff in that case. You will have to combine bootloader and application image manually (using some python script or whatever works for you).
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #60 on: September 20, 2017, 06:27:02 am »
It is not about the steps. It is about how application talks to the bootloader.
You need to figure out a way to place a function that blinks an LED in the bootloader section and call that function from the application. However you do that is not important.
yes.I tried such function and called it from application ..nothing has happened.First of all i programmed bootloader and initial image is loaded via serial port.That worked.Now my device have bootloader and initial image of application i suppose.Also I tried to see wthethr appSwitch() function is worked or not for OTA .That one also not worked.So I think my device have bootloader and application but while using OTA its not calling any of the function in bootloader.Do we need to specify anythng to make this function work.
« Last Edit: September 20, 2017, 06:31:33 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #61 on: September 20, 2017, 06:30:49 am »
Do we need to specify anythng to make this function work.
I'll say it one more time and I'm out of here.

You need to understand what are you doing and what is missing. You've got enough information to do this. Just take time to actually do it. I can't teach you programming in a forum thread.

Use the debugger and singe step though the program to see what is happening and what needs to happen.
Alex
 
The following users thanked this post: vishal

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #62 on: September 20, 2017, 06:33:19 am »
okay I will try ...Thank you so much for your great support.It was really helpful.I understood the basic facts .. Will try.
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #63 on: September 27, 2017, 12:47:30 pm »
Hi, I start it from the beginning. and I have done the following
1)I uploaded bootloader.
2)have loaded the initial image via serial interface
3)Tried OTA
While debugging I found that the appSwitch() function is not called
In OtaInterface.c the following lines of code is not working
Code: [Select]
else if(OTA_UPGRADE_COMPLETED_STATUS==status)
{
   appWritePage();
   appSwitch();
   appUpgradeInProgress=false;
}

and I have  seen in otaclient.c the above lines get invoked when calling the following.but that one also not become true .it shows that 0 !=otaclient.size
Code: [Select]
void OTA_ClientBlockConfirm(OTA_Status_t status){
 if(OTA_SUCCESS_STATUS==status && 0 ==otaclient.size){
   otaclientSendResponse(OTA_UPGRADE_COMPLETED_STATUS)
}
}
           Two blocks are written and after it shows "Error: unexpected status (OTA_NO_RESPONSE_STATUS)"..In one of the forum i read this error is because there is no bootloader.but in my case i have the bootloader and i could upload application via serial terminal.
           Also you have mentioned several times about 4-byte (size)  for avr-atmega256rfr2.Where can I check it and where I can I change it.I am using avr-gcc to compile.do it hav dependency.Kindly reply .
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #64 on: September 27, 2017, 03:33:17 pm »
Forget about switch. Make sure that normal pages are written.

C pointer is 4 bytes on m256, check the size of the C pointer.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #65 on: September 28, 2017, 04:49:21 am »
Before checking it  i have one more doubt
My linker scrpit is attached here with  and I changed the following lines in bootloader.c

Code: [Select]
__attribute__((section(".iap.write_page"))) void (*iap_write_page)(uint32_t, uint16_t *) = iap_write_page_handler;
__attribute__((section(".iap.switch"))) void (*iap_switch)(void) = iap_switch_handler;
to
Code: [Select]
__attribute__((section(".boot.write_page"))) void iap_write_page_handler(uint32_t addr, uint16_t *buf);
__attribute__((section(".boot.switch"))) void iap_switch_handler(void);
Is there any error with this line
While compiling with this change it shows the error "lf section `.boot' will not fit in region `boot'"..how can I  change the memroy value to fit the boot section
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #66 on: September 28, 2017, 04:57:24 am »
Region 'boot' is declared as 4 bytes in size.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #67 on: September 28, 2017, 11:14:07 am »
Region 'boot' is declared as 4 bytes in size.
I solved it by incresing the size from 4 to 264.now the boot section fit in to the memory.
Forget about switch. Make sure that normal pages are written.
I cant write the normal pages.The flash image of the device is attached

Quote
C pointer is 4 bytes on m256, check the size of the C pointer.
Where can I see the size.Is it in the linker script or its depend on compiler?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #68 on: September 28, 2017, 03:09:36 pm »
Where can I see the size.Is it in the linker script or its depend on compiler?
Google it, or compile a simple program and see hoe big the pointer is.

But with your new bootloader approach, it does not matter. All you need to do now is use the same script for the application, and may be a bit debugging. With this approach compiler should figure out how to execute those functions.

Forget about writing flash. Make sure that you can reliably call function from the application to the bootloader.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #69 on: September 29, 2017, 02:55:59 am »
Forget about writing flash. Make sure that you can reliably call  function from the application to the bootloader.
If I  want to write a function to blink an led ; I write the function in bootloader.c .then how can I call it from application..Is it in the same way that IAP_SWITCH_HANDLER  and IAP_WRITE_PAGE_HANDLER in otaInterface.c .
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #70 on: September 29, 2017, 02:57:25 am »
Yes. It is exactly the same. The exact details depend on which version of the linker script you are using.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #71 on: September 29, 2017, 03:05:07 am »
IAP_SWITCH_HANDLER defines (SYS_DEVICE_SIZE -4) .Is it the memory loaction that the funcion points to?.If I have BLINK_LED what should it defines? Do we need to care anythng in function naming(i,e to use the same name in boot loader and otainterface).
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #72 on: September 29, 2017, 03:07:02 am »
That is a location of a pointer to a function inside the bootloader. This is not what you want for your last linker script.

But I don't get how you can continue like this without trying to do any investigation on your own. I will not teach you how to debug things, there are plenty of tutorials on this.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #73 on: September 29, 2017, 08:29:31 am »
But I don't get how you can continue like this without trying to do any investigation on your own. I will not teach you how to debug things, there are plenty of tutorials on this.
Sorry, Actually I am not well aware of the linker script.I know here its used to link bootloader and application.But what address should be given and how it depends on the application is unknown.I am debugging the OTA client and OTA interface to see what part works and doesn't.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #74 on: September 29, 2017, 04:11:05 pm »
Sorry, Actually I am not well aware of the linker script.
It is time to learn.

I know here its used to link bootloader and application.
Linker script is just an instructions on where to put things on the memory. You need to understand what things you put there and where, and then it will be obvious how to make them work.

But what address should be given and how it depends on the application is unknown.
You should know it, you are designing the application, it is up to you do define that.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #75 on: October 16, 2017, 06:18:43 am »
Hi,As you said i tried to blink and LED in  iap_write_page() function of  bootloader section from application.
For this I called appWritePage() from application(the control in turn goes to iap_write page()). Also added the led blinking code in iap_write_page() function.   In linker script of bootloader I have
Code: [Select]
MEMORY
{
  text   (rx)   : ORIGIN = 0x0003f800, LENGTH = 256K-2K
  boot   (rx)   : ORIGIN = 0x0003fffc, LENGTH = 2K
  data   (rw!x) : ORIGIN = 0x00800190, LENGTH = 32K-500
}
Also In script the boot section is like this
Code: [Select]
  .boot :
  {
   
    *(.boot.switch)
   
    *(.boot.write_page)
    KEEP(*(.boot.*))
  } > boot

When I used ALIGN(256) it showed error that the address not fit in range.
In bootloader.c I defined
Code: [Select]
__attribute__((section(".boot.write_page"))) void (*iap_write_page)(uint32_t, uint16_t *) = iap_write_page_handler;
__attribute__((section(".boot.switch"))) void (*iap_switch)(void) = iap_switch_handler;

Also in created  led.h file  I have defined
Code: [Select]
#define STARTING_ADDRESS        (SYS_DEVICE_SIZE / 2)
#define IAP_SWITCH_HANDLER      (SYS_DEVICE_SIZE - 4)
#define IAP_WRITE_PAGE_HANDLER  (SYS_DEVICE_SIZE - 2)

here SYS_DEVICE_SIZE =262144 .So IAP_SWITCH_HANDLER points to 3fffc.I added LED blinking code in both iap_write_page_handler and iap_switch_handler.but nothing worked.
please clarify me the following
1) Do I need same linker script in application(tried with one but no use)
2)Do I need to specify
Code: [Select]
  .boot :
  {
    . = ALIGN(256);
    *(.boot.switch)
    . = ALIGN(256);
    *(.boot.write_page)
    KEEP(*(.boot.*))
  } > boot


If so i have to adjust iap address..Kindly suggest a solution
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #76 on: October 16, 2017, 06:21:40 am »
I will only answer once you explain to me the purpose of the ". = ALIGN(256);" statements. If you still don't understand it, you need to do more reading and experiments with linker scripts. Without this, the whole thing is a waste of time.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #77 on: October 16, 2017, 06:33:53 am »
ALIGN aligns the section to a particular boundary.here 256 bytes allocated for each of the iap functions.
I havent see in other linker script(atmega128rfr1) to align this section.If I have to use this I need to adjust iap address.thats why get confused
« Last Edit: October 16, 2017, 06:37:37 am by vishal »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #78 on: October 16, 2017, 06:36:30 am »
Well, can you answer your own question whether you need them here or not?

You will have to look at disassembler output and trace execution of the code. There is no way to avoid this. And once you see what actuall happens on hardware level, you will know what you need to change.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #79 on: October 25, 2017, 10:15:35 am »
Hi,
I started to debug.While debugging I found that the OTAclient response data is not arriving at OTA server.But in OTAclient it sends.but nothing hit in otaServerDataInd().I understood only after getting OTA_SUCCESS_STATUS from the client to server it starts to send blocks of bytes to upgrade.Here the initial OTA_SUCCESS_STATUS is not receiving and execution end after exceeding maximum try count.Checked the hardware with peer to peer code.both devices send and receive.no issue.but here client response is not hitting in server.The client can receive from the server.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #80 on: October 25, 2017, 04:56:47 pm »
As I said numerous times, forget about OTA and files and LwMesh for now. Make two projects.  One is a bootloader that contains certain function you need to call. The other one is a simple main() that calls that function. That's all you need to do now. That's how you debug.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #81 on: October 26, 2017, 05:10:21 am »
Yes..I did it.I wrote a blinkLED() in bootloader.c and called it from application.it worked.In bootloader.c  i have
Code: [Select]
__attribute__((section(".boot.blink")))void(*blink_led)(void)=blinkLED;
void blinkLED(){
 for(uint8_t i=0;i<10;i++){
   DDRD|=(1<<6);
   PORTD|=(1<<6);
   _delay_ms(100);
  PORTD&=~(1<<6);
 _delay_ms(100);

}

in application i have

Code: [Select]
static void *appGetIapHandler(uint32_t addr){

  void *handler;
  #if defined(__ICCAVR__)
  memcpy_P((void *)&handler,(void const __farflash*)addr,sizeof(void *));
  #else
  handler=(void *)pgm_read_word_far(addr);
  #endif
  return handler;
}

static void blink_led(void){

   blinkled_t blink=(blinkled_t) appGetIapHandler(BLINK_LED);
  ATOMIC_SECTION_ENTER
  EIND=1;
  blink();
  EIND=0;
  ATOMIC_SECTION_LEAVE
}


It worked.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #82 on: October 26, 2017, 05:18:59 am »
Ok, good.

The only thing to check is that APP_OTA_ENDPOINT is the same on both sides. Otherwise - debug.

But if I remember correctly, you have this part working already. What happened to that?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #83 on: October 26, 2017, 05:24:30 am »
APP_OTA_ENDPOINT is set as 2 on both sides. Now the issue in the initial OTA_SUCCESS_STATUS not receiving in the otaserver....Also i tested to send some data to the server to see wther anythng hit in otaServerDataInd().but nothing is getting there.Hope that if it solved all other thing works.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #84 on: October 26, 2017, 05:27:46 am »
What "initial OTA_SUCCESS_STATUS"? This OTA is a request-response. What request is not getting answered?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #85 on: October 26, 2017, 05:30:29 am »
The server is not getting any response from client.But the client can receive request and it sends response.That response not receiving in the server
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #86 on: October 26, 2017, 05:32:02 am »
What are the parameters of the NWK_DataReq_t that client uses to send the response, and what status code it receives in the confirmation handler?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #87 on: October 26, 2017, 06:28:30 am »
It returns  NWK_NO_ROUTE_STATUS(0x11).


The parametrs set are
Code: [Select]
otaDataReq.srcEndpoint=APP_OTA_ENDPOINT;
otaDataReq.dstEndpoint=APP_OTA_ENDPOINT;
otaDataReq.options=NWK_OPT_ACK_REQUEST;
otaDataReq.dstAddr=otaclient.server;
otaDataReq.size=sizeof(OtaStartRespCommand_t)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #88 on: October 26, 2017, 06:32:47 am »
I meant actual numerical values, I have the code. Does otaclient.server matches the actual address of the server?

I don't know basically, debug. Single step it and see what is failing and where.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #89 on: October 26, 2017, 06:36:37 am »
I meant actual numerical values, I have the code. Does otaclient.server matches the actual address of the server?


Code: [Select]
otaDataReq.srcEndpoint=2;
otaDataReq.dstEndpoint=2;
here otaclient.server address is 0x8555.I also tried it by directly giving it as otaDataReq.dstAddr=0x8555;but no use.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #90 on: October 26, 2017, 06:44:42 am »
This all looks ok. Having a sniffer would help a lot.

Without the sniffer, all you can do  is check why route is not found. Looks in the stack routing tables.

Also, try to set a different address (like 5) to the server.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #91 on: October 31, 2017, 05:23:21 am »


Also, try to set a different address (like 5) to the server.
I tried but no use with this address change.while debugging the NWK_NO_ROUTE_STATUS appear when we enable the  NWK_ENABLE_ROUTE_DISCOVERY in the application.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #92 on: October 31, 2017, 05:24:29 am »
I tried but no use with this address change.while debugging the NWK_NO_ROUTE_STATUS appear when we enable the  NWK_ENABLE_ROUTE_DISCOVERY in the application.
Do you enable this on both sides?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #93 on: October 31, 2017, 05:44:19 am »
yes, I have enabled it on both sides.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #94 on: October 31, 2017, 05:45:51 am »
Well, then you will have to trace why the receiving side does not respond to the route request. It usually just works, so something is broken on your side.

You may want to start with a clear version of the stack/application, and apply your changes on top.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #95 on: October 31, 2017, 06:39:44 am »
I start it from beginning with a clear stack.Now the error I got is  NWK_NO_ACK_STATUS  and  NWK_PHY_NO_ACK_STATUS   
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #96 on: October 31, 2017, 06:41:03 am »
Your devices appear to have some hardware issues.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #97 on: October 31, 2017, 06:43:10 am »
but it will work for basic peer to peer to communication and WSNDemo..So can we confirm it to have hardware issue
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #98 on: October 31, 2017, 06:46:03 am »
but it will work for basic peer to peer to communication and WSNDemo..So can we confirm it to have hardware issue
Those applications perform multiple retries, and generally tolerant to lost data. Run WSNDemo and actually check status codes.

It is virtually impossible to get NWK_PHY_NO_ACK_STATUS on working hardware and in a clean environment.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #99 on: October 31, 2017, 06:59:59 am »
I checked the hardware again with the basic WSNDemo application.It works fine.and returns NWK_STATUS_SUCCESS code.no issue has found in hardware.Then why i am getting NWK_NO_ACK_STATUS and NWK_PHY_NO_ACK_STATUS in OTA application
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #100 on: October 31, 2017, 07:01:05 am »
DEBUG! I don't know. I'm not clairvoyant.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #101 on: November 02, 2017, 07:46:03 am »
I have had some success. I got bootloader and OTA worked
.Thank you so much for your support
« Last Edit: November 02, 2017, 08:03:21 am by vishal »
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #102 on: November 16, 2017, 06:32:54 am »
Hi ,
  Now am trying to modify the bootloader with a small change.instead of checking PE0 pin it should start the application automatically once it's programmed.For this in reboot function
I commented while(1)
i.e
Code: [Select]
main(){
if(bootloader_mode()){
hardware_init();
receive_file();
reboot();
}

reset_vector();
}

The reboot looks like this
Code: [Select]
static void reboot(void)
{
wdt_reset();
WDTCSR=(1<<WDCE) |(1<<WDE);
WDTCSR=(1<<WDE);
//while(1);
}

Now I could automatically switch to the application once it programmed.But at that time I completely lost bootloader from the device.Why it so happens.How can I switch to the application automatically by keeping bootloader section as it is?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error
« Reply #103 on: November 16, 2017, 06:37:48 am »
You are enabling WDT and then no waiting for it to reset the MCU. Just delete the while reboot function, if you want it to start the application right away. But you may want to bring back the state of all the hardware that bootloader used.

None of this should have erased the bootloader though, so I have no idea what else you did wrong.
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf