Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflash firmware without CCDebugger/Arduino #320

Closed
kirovilya opened this issue Aug 30, 2018 · 28 comments
Closed

Reflash firmware without CCDebugger/Arduino #320

kirovilya opened this issue Aug 30, 2018 · 28 comments
Labels
feature request Feature request stale Stale issues

Comments

@kirovilya
Copy link
Contributor

kirovilya commented Aug 30, 2018

ZNP firmware for cc253* has a built-in bootloader that can be used to updated firmware via USB / UART into the cc2531 stick or simply the cc2530 chip without using CCDebugger or Arduino.

But this requires not a conventional hex-firmware, but a special sbl-firmware (Serial Boot Loader).

For the normal firmware, the process of assembling it is described here https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/CC2531
And for SBL firmware, everything is the same, but the assembly CC2531-ProdSBL (or CC2530) is selected. In this case, not a hex file (680Kb) is generated, but a bin-file (234Kb).
And with one exception - it is necessary to specify MAKE_CRC_SHDW instead of FAKE_CRC_SHDW defined symbols.

prodspl

This firmware must be flashed through SerialBootTool. It comes with IAR, or you can download it separately here http://processors.wiki.ti.com/index.php/File:SerialBootTool_1_3_2.zip

When starting SerialBootTool, you must select Zigbee family. Then select the SBL firmware (bin-file). And then select port and specify the parameters of the port where cc253* is connected.

serialboottool

After that, you need to re-insert the cc2531 stick or disconnect and reconnect the board with the cc2530 chip and click Load Image. Only in first minute after the connection is available bootloader mode!

writeimage

The firmware will be executed and the chip can be used again.

@arteck
Copy link
Contributor

arteck commented Sep 3, 2018

brilliant

@ciotlosm
Copy link
Contributor

ciotlosm commented Sep 3, 2018

@kirovilya will this allow to flash sticks in a way that maybe allow a RPI to update firmware without removing stick? I was thinking of a process for example where an addon like we have for hassio would be able to check current stable firmware against the one on the stick and update accordingly if needed?

@danielwelch

@ciotlosm ciotlosm added the feature request Feature request label Sep 3, 2018
@kirovilya
Copy link
Contributor Author

@ciotlosm if we can programmatically switch to bootloader mode, then I think yes.
but I do not know how to do it.

@lubeda
Copy link

lubeda commented Sep 4, 2018

Is there a download for the bin file available?

@tb-killa
Copy link
Contributor

tb-killa commented Sep 4, 2018

@kirovilya What about this informations: ?? http://processors.wiki.ti.com/index.php/CC253x_Serial_Boot_Loader#
There is the part: Reset on a Serial Command ..
Maybe it could help :)

@kirovilya
Copy link
Contributor Author

@lubeda Not yet, but we can build them if you need to...

@tb-killa Good link... I looked at example. It says that 0xF8 code in uart will go to serial bootloader...

image

Then I looked at our ZNP-firmware and found code:

image

BUT! Symbol MT_SYS_RESET_HARD = 0

image

Perhaps this is a mistake in the commentary :))

So, this function called with SYS_RESET_REQ command:

image

Zigbee-Shepherd and cc-znp used this table https://github.com/zigbeer/cc-znp/wiki/6.-Z-Stack-MT-API-Reference-Tables#sys-commands
... and in code it never call with 0x0 type of reset ...

image

Ok. If we send 0x0 type to resetReq - we going to serial bootloader mode... and what next? :))

I think it's not worthwhile to make the firmware through zigbee2mqtt - this should be done by separate tools that can use zigbee-shepherd to switch to serial bootloader mode.

@lubeda
Copy link

lubeda commented Sep 4, 2018

@kirovilya a download with a ready made .bin file would be very helpful for all without a cc-debugger. I planed to flash the cc2531 the arduino way until i found that it would take more than an hour...

@kirovilya
Copy link
Contributor Author

@lubeda as I said, this method is suitable only for repeated firmware (not the first). since the bootloader must be flashed first.

@tb-killa
Copy link
Contributor

tb-killa commented Sep 4, 2018

@kirovilya yes the flashing should be complete alone. We could use some sort of api from App to zigbee shepherd for bring in reset. But this is feature :)

@tb-killa
Copy link
Contributor

@kirovilya We should check this too: http://processors.wiki.ti.com/index.php/Optimizing_Flash_and_RAM_Usage_of_Z-Stack_for_CC2530
If we could build firmware with maximum available heap we could hopefully fix the error:17 problems.

@Chrischi-
Copy link
Contributor

Chrischi- commented Sep 20, 2018

Here is my compiled .bin file for the CC2531.
It's tested and i uploaded it with SerialBootTool to my own CC2531 stick.

I did a optimization before compiling. I resized the XDATA Stack from 0x4D0 to 0x300.
This decreases the free RAM from 1232 bytes to 768 bytes.

After that we can define + allocate the space for the following no. of devices, neighbor

NWK_MAX_DEVICE_LIST=40
MAX_NEIGHBOR_ENTRIES=5

BIN File (242 KB): CC2531ZNP-D40-N5.bin.zip

@stale
Copy link

stale bot commented Dec 22, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@roger-
Copy link
Contributor

roger- commented Feb 12, 2019

Is it possible to use SerialBootLoader to update a CC2531 that was previously flashed (and working) with the Arduino approach?

In Windows 10 this always gives "COM Port Open Error".

@HA-TB303
Copy link

HA-TB303 commented Feb 14, 2019

Hi, I purchased this module to try with zigbee2mqtt:
http://www.hexin-technology.com/1000m_TTL_to_ZigBee_Module-Product-566.html

I tried flashing it using a USB to serial adapter and this method, but I don't get a connection.

Can anybody tell me how to flash this thing successfully either using this method or a cc debugger?

@ryanbeaton
Copy link

Hi @Michel72
I’d say you’ll be connecting a debugger to the five pin holes.
cf29ecb3-33d1-4d64-abcc-da93605c92a2

@HA-TB303
Copy link

Thx, do you know the pinout for this connection? It’s not documented anywhere.

@atzbert
Copy link

atzbert commented Mar 26, 2020

Here is my compiled .bin file for the CC2531.
It's tested and i uploaded it with SerialBootTool to my own CC2531 stick.

I did a optimization before compiling. I resized the XDATA Stack from 0x4D0 to 0x300.
This decreases the free RAM from 1232 bytes to 768 bytes.

After that we can define + allocate the space for the following no. of devices, neighbor

NWK_MAX_DEVICE_LIST=40
MAX_NEIGHBOR_ENTRIES=5

BIN File (242 KB): CC2531ZNP-D40-N5.bin.zip

Does anyone have a newer version of this? Maybe? :)

@Chrischi-
Copy link
Contributor

No because @Koenkk 's files are perfect for every situation right now.

Still waiting to get hands on a zig-a-zig-ah device

@atzbert
Copy link

atzbert commented Mar 26, 2020

Ok, I guess I was on the wrong track anyway. But maybe someone (@Chrischi- ?) can point me in the right direction.
I have two preflashed CC2531 coordinators (bought one with ext antenna later).
Now I'd like to make one of them a router to extend my network.
I don't have the hardware to flash it using CCDebugger.
If I understand correctly I'd need a SBL router firmware for that.
But how to make one or where to find it?

@maxschloegl
Copy link

I tried to flash with SBL (SerialBootTool) but it does not show up there. I find it in my hardware manager in Windows 10 but the driver is missing. Can anybody tell me from where i can get the driver?
grafik

BR

@Anon0ne
Copy link

Anon0ne commented Apr 22, 2020

Any change you can make me a bin for router firmware? I cannot seem to make a proper bin with the methods on website. It is 256kb instead of 234 and obviously I cant choose to change CRC_SHADOW.

@Anon0ne
Copy link

Anon0ne commented Apr 22, 2020

No because @Koenkk 's files are perfect for every situation right now.

Still waiting to get hands on a zig-a-zig-ah device

We need a router edition though? I not sure what software was used to make the .bin file because the link is broken.

@puddly
Copy link

puddly commented Jun 7, 2020

I couldn't find a cross-platform version of SerialBootTool so I implemented it in zigpy-znp. You can use it standalone to flash a CC2531 on any platform even if you don't use ZHA/zigpy:

$ pip install zigpy-znp
$ python -m zigpy_znp.tools.flash_read /dev/serial/by-id/radio -o flash.bin
$ python -m zigpy_znp.tools.flash_write /dev/serial/by-id/radio -i flash.bin

Warning: I've used it and it worked for me but I can't guarantee that it will work for you. I don't suggest you try it unless you have a way to recover.

@h4nc
Copy link

h4nc commented Jun 26, 2020

Referencing to #31 because questions about router bin files came up here too.

@TTLucian
Copy link

Can the router firmware be flashed by using this method (SBL) on a CC2531 USB dongle preloaded with CC2531ZNP-Prod firmware?

@sousaaguilherme
Copy link

sousaaguilherme commented Jul 27, 2021

No because @Koenkk 's files are perfect for every situation right now.

Still waiting to get hands on a zig-a-zig-ah device

Hi @Chrischi-

Does that mean that I can follow this procedure with this firmware CC2531_DEFAULT_20201127.zip without any changes to the bin and hex? Tks 😄

Edit:
Well I've tried and it worked with no issues! Thanks a lot to all 💪

@iotinkognito
Copy link

Utilising the serial boot tool on CC2531 worked for me. Literally stop HA, plug into Windows 10 machine, run the tool, select the com port and then load image (Downloaded from here. https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/default)... bam done.

@PLTorrent
Copy link

Hi, does anyone happen to have SNIFFER FW for CC2531 in this (bin) format? Is it possible to flash sniffer SW using this method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request stale Stale issues
Projects
None yet
Development

No branches or pull requests