Author Topic: Atmel-8390-WIRELESS-AVR2054-Serial-Bootloader Upload Error  (Read 14445 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.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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 »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • 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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf