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

Defining EZSP Radio manufacturer/EZSP Radio board name #1

Closed
tube0013 opened this issue Jun 7, 2021 · 20 comments
Closed

Defining EZSP Radio manufacturer/EZSP Radio board name #1

tube0013 opened this issue Jun 7, 2021 · 20 comments

Comments

@tube0013
Copy link

tube0013 commented Jun 7, 2021

Have you figured out how to define the manufacturer and board name in the project before compiling the fw?

it looks like these are the keys:
image

I tried setting like this but it doesn't work:
image

image

@MattWestb
Copy link
Owner

So its looks like this ?
MWZBB01

ZCL Cluuster - General - Basic - and on the attribute side all info you need.
I was having adding some extra that was not "fitting" and was writing in other attribute but the standard is working OK.

MWZBB02
(not the same device :)) )

@MattWestb
Copy link
Owner

MattWestb commented Jun 7, 2021

You can also changing the manufacture to one from the "real list" on the upper left on the ZCL Cluster tab (I using IKEA for My IKEA modules).
The OTA image ID that i used for OTA is made in the OTA plugin and the manufacture is from the ZCL cluster tab.

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

thanks - I'm talking with the coordinator FW. like your Billy. I know you modified it post compile at one point.

@MattWestb
Copy link
Owner

Sorry i was not seeing you update.

Its manufacture tokens that is stetted with simplicity commander.

I have hacking the token in the user flash aria so bellows / ZHA is writing "Billy EZSP" as model.

Its described writing the token is in the manual for commander but the token is described is one manufacturing paper.

But i think you also can writing it from EZSP if the command is implanted.

I must looking for the manual i was finding token name and place and reporting back.

@MattWestb
Copy link
Owner

@MattWestb
Copy link
Owner

Here is my bin patched bin file (from one GU10) with my data.

LED1836G9_UD_MW.bin.txt (added .txt for uploading)

You shall using the offset for MG2 devices and then converting it to one format that you can flash to user data aria in the flash.

I think its possible doing TXT file with the token and using commander CLI for flashing it and also EZSP is having the commands.

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

I see, I'll have to dig into this some more. appreciate pointing me in the direction!

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

Looks like you can define them in a header... just a matter of what that would look like ;)

image

@MattWestb
Copy link
Owner

MattWestb commented Jun 7, 2021

The easy way is making one bin file and converting it to s37 and flashing to the device.
I think commander is doing the converting OK but must specification the user data aria for bin file so its being written OK.

I think its possible using segger flasher and flashing the "raw bin file" but i have not testing it.

Un patched data files form the new IKEA E2001 dumped with segger flasher that you can using as reference and changing if you like (its one MG21 device) but they have putting little extra data after the normal token.
MG21_UD.zip

If you is patching the EZSP firmware its away if flashing one "other" firmware.

The manufacture token (in user data) is still there also after one debug unlocking and flash erase but not one complete chip erase.

@MattWestb
Copy link
Owner

You can reading the user data with segger flasher and editing it in the gui and flashing it back and looking how its working then booting the ncp with bellows and if its OK dumping the user data and exporting it as s37 and you can flashing it with normal simplicity commander then making the "manufacturing".

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

I will play with it. thanks!

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

https://www.silabs.com/community/wireless/proprietary/knowledge-base.entry.html/2020/11/12/creating_custom_manufacturingtokensinconnectba-zaxl

this would be my goal, to just have it compiled in at compile time.

so using this example, I'd need the address where the token goes and the token in hex?

@MattWestb
Copy link
Owner

MattWestb commented Jun 7, 2021

I think that is not the same token as you like to using.
Its more like IKEA is using for overriding the device name and other default firmware parameters in the OTA firmware. Its stored after the "real" manufacture tokens in the user data aria.

In https://www.silabs.com/documents/public/user-guides/ug162-simplicity-commander-reference-guide.pdf 6.4 Token Commands and the token group is znet.

You can also doing the normal NCP firmware and combining it with one file for the user data with your token (Edit: dumped userdata with your token like i was doing in one s37 file for user to flashing) and you is having one s37 file with both for the user to flashing.

Its also possible "patching" with commander = writing data to flash that is not standard but its not easier to do.

@MattWestb
Copy link
Owner

If you is getting the manufacturing token in one module you can redeeming them to one file and then adding them to your s37 file with commands 6.5.3 Define Tokens (ug162).

$ commander convert blink.s37 --tokengroup znet --tokenfile tokens.txt --device EFR32MG1P --outfile blink.hex
Converts blink.s37 to hex format, while simultaneously defining the tokens defined in tokens.txt and on the command line.

You can using one output file with s37 and you is having all in your custom s37 file NCP and tokens.

Its command for writing the tokens also to file or chip but i think its easier doing it in one bin file or in segger flasher and flashing it back to user data and redeeming it with commander to one token file.

Then you have making one token file you can using it for all MG2 devices only adding it with the command from 6.5.3.

ug162 = simplicity-commander-reference-guide.pdf

@tube0013
Copy link
Author

tube0013 commented Jun 7, 2021

I think I'm going to try with the header option at compile time I just need to figure out the right way to define what I want in the header.

@MattWestb
Copy link
Owner

MattWestb commented Jun 7, 2021

I was trying dumping the token from my billy file but it was not working :-((
But i think you can using it only putting in what you like and deleting what you not need and using "convert" for adding it to our s37 file.

#
# This token file declares what values are programmed for manufacturing
# tokens on the chip. It can be read back by the "flash" or "convert" commands.
#
# Lines are composed of one of the following forms:
#   <token-name> : <data>
#   <token-name> : !ERASE!
#
# Omitted tokens are left untouched and not programmed on the chip.
# Token names are case INsensitive.  All integer values are interpreted as hexadecimal
# numbers in BIG-endian format and must be prefixed with '0x'.  Blank lines and 
# lines beginning with '#' are ignored.
# Byte arrays are given in hexadecimal format, without a leading 0x.
# Specifying !ERASE! for the data sets that token to all F's.
#
#
# The token data can be in one of three main forms: byte-array, integer, or string.
# Byte-arrays are a series of hexadecimal numbers of the required length.
# Integers are BIG endian hexadecimal numbers.
# String data is a quoted set of ASCII characters.
#
# MFG_EMBER_EUI_64              : FFFFFFFFFFFFFFFF
MFG_CUSTOM_VERSION            : 0xFFFF
MFG_CUSTOM_EUI_64             : FFFFFFFFFFFFFFFF
MFG_STRING                    : ""
MFG_BOARD_NAME                : ""
MFG_MANUF_ID                  : 0xFFFF
MFG_PHY_CONFIG                : 0xFFFF
MFG_ZWAVE_COUNTRY_FREQ        : 0xFF
MFG_ZWAVE_HW_VERSION          : 0xFF
MFG_ZWAVE_PSEUDO_RANDOM_NUMBER: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_SERIAL_NUMBER             : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_SYNTH_FREQ_OFFSET         : 0xFFFF
MFG_CCA_THRESHOLD             : 0xFFFF
MFG_EZSP_STORAGE              : FFFFFFFFFFFFFFFF
MFG_CTUNE                     : 0xFFFF
MFG_XO_TUNE                   : 0xFFFF
MFG_LFXO_TUNE                 : 0xFF
MFG_KIT_SIGNATURE             : FFFFFFFF
MFG_LOCKBITS_CLW0             : 0xFFFFFFFF
MFG_LOCKBITS_MLW              : 0xFFFFFFFF
MFG_LOCKBITS_ULW              : 0xFFFFFFFF
MFG_LOCKBITS_DLW              : 0xFFFFFFFF
MFG_BOOTLOAD_AES_KEY          : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_SECURITY_CONFIG           : 0xFFFF
MFG_ZW_PRK                    : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_ZW_PUK                    : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_ZW_QR_CODE                : ""
MFG_NVM3_CRYPTO_KEY           : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
MFG_ZW_QR_CODE_EXT            : ""
MFG_ZW_INITIALIZED            : 0xFF

MFG_ASH_CONFIG[0]  : 0xFFFF
MFG_ASH_CONFIG[1]  : 0xFFFF
MFG_ASH_CONFIG[2]  : 0xFFFF
MFG_ASH_CONFIG[3]  : 0xFFFF
MFG_ASH_CONFIG[4]  : 0xFFFF
MFG_ASH_CONFIG[5]  : 0xFFFF
MFG_ASH_CONFIG[6]  : 0xFFFF
MFG_ASH_CONFIG[7]  : 0xFFFF
MFG_ASH_CONFIG[8]  : 0xFFFF
MFG_ASH_CONFIG[9]  : 0xFFFF
MFG_ASH_CONFIG[10] : 0xFFFF
MFG_ASH_CONFIG[11] : 0xFFFF
MFG_ASH_CONFIG[12] : 0xFFFF
MFG_ASH_CONFIG[13] : 0xFFFF
MFG_ASH_CONFIG[14] : 0xFFFF
MFG_ASH_CONFIG[15] : 0xFFFF
MFG_ASH_CONFIG[16] : 0xFFFF
MFG_ASH_CONFIG[17] : 0xFFFF
MFG_ASH_CONFIG[18] : 0xFFFF
MFG_ASH_CONFIG[19] : 0xFFFF

MFG_LOCKBITS_PLW[0] : 0xFFFFFFFF
MFG_LOCKBITS_PLW[1] : 0xFFFFFFFF
MFG_LOCKBITS_PLW[2] : 0xFFFFFFFF
MFG_LOCKBITS_PLW[3] : 0xFFFFFFFF

#'MFG_CBKE_DATA (Smart Energy CBKE)' token group
Device Implicit Cert : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
CA Public Key        : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Device Private Key   : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# CBKE Flags           : 0xFF

#'MFG_INSTALLATION_CODE (Smart Energy Install Code)' token group
# Install Code Flags : 0xFFFF
Install Code       : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# CRC                : 0xFFFF

#'MFG_SECURE_BOOTLOADER_KEY (Manufacture token space for storing secure bootloader key.)' token group
MFG_SECURE_BOOTLOADER_KEY : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

#'MFG_CBKE_283K1_DATA (Smart Energy 1.2 CBKE)' token group
Device Implicit Cert (283k1) : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
CA Public Key (283k1)        : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Device Private Key (283k1)   : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# CBKE FLAGS (283k1)           : 0xFF

#'MFG_SIGNED_BOOTLOADER_KEY_X (Manufacture token space for storing ECDSA signed bootloader key (X-point).)' token group
MFG_SIGNED_BOOTLOADER_KEY_X : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

#'MFG_SIGNED_BOOTLOADER_KEY_Y (Manufacture token space for storing ECDSA signed bootloader key (Y-point).)' token group
MFG_SIGNED_BOOTLOADER_KEY_Y : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

#'MFG_THREAD_JOIN_KEY (This is a token for saving the join key. This is for use with the Silicon Labs Thread stack only.)' token group
Join Key        : ""
# Join Key Length : 0xFFFF

tokens.txt

You is having your token in the file in 5 minutes with this method only editing the file and convert the NCP.s37 file and you is having it !!!

Edit: the

MFG_STRING                    : ""
MFG_BOARD_NAME                : ""

Is normal strings so only putting TubeZigbee in there :-)))

@MattWestb
Copy link
Owner

With one token file like this (attached):

MFG_STRING                    : "IKEA of Sweden"
MFG_BOARD_NAME                : "Billy EZSP by MW"
MFG_MANUF_ID                  : 0x110C

And flashing with commander:

.\commander.exe flash --tokengroup znet --tokenfile .\tokens-MW.txt -d EFR32MG1P132F256IM32
WARNING: The string for token MFG_BOARD_NAME (Billy EZSP by MW) fills all 16 bytes of the token space. The string will not be zero terminated.
Writing 2048 bytes starting at address 0x0fe00000
Comparing range 0x0FE00000 - 0x0FE007FF (2 KB)
Erasing range 0x0FE00000 - 0x0FE007FF (1 sector, 2 KB)
Programming range 0x0FE00000 - 0x0FE001FF (512 Bytes)
Programming range 0x0FE00200 - 0x0FE003FF (512 Bytes)
DONE

I is getting from bellow (have doing one chip erase then was bricking the module and recovering it with simplicity commander so it was not having "my signature"):

Manufacturer: IKEA of Sweden
Board name: Billy EZSP by MW
EmberZNet version: 6.9.0.0 build 178

tokens-MW.txt

You only need changing the token in the file and also the device type (MG2X is different then MG1X) then flashing / covering tokens to one NCP / firmware file.

You is having it in the device in 5 minutes and also in s37 file and its staying in the chip until doing one chip erase also then the user is flashing some other firmware without attached tokens :-)))

For attaching / patching it to the s37 file see #1 (comment)

You also can using MFG_SERIAL_NUMBER : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF for putting order number or serial number in the chip before shipping the device but bellows is not showing it for the moment but our code master can fixing that is some minutes :-))

Command for flashing one token or token file plus one tocken:

commander flash --tokengroup znet --token TOKEN_MFG_STRING:"IoT Inc"
commander flash --tokengroup znet --tokenfile tokens.txt --token TOKEN_MFG_STRING:”IoT Inc”

@tube0013
Copy link
Author

tube0013 commented Jun 8, 2021

thank you!

2021-06-08 15:07:07 DEBUG (MainThread) [bellows.zigbee.application] APS_UNICAST_MESSAGE_COUNT is set to 64
2021-06-08 15:07:07 DEBUG (MainThread) [bellows.zigbee.application] Ezsp adding endpoint: [<EzspStatus.SUCCESS: 0>]
2021-06-08 15:07:08 INFO (MainThread) [bellows.zigbee.application] EZSP Radio manufacturer: tubesZB
2021-06-08 15:07:08 INFO (MainThread) [bellows.zigbee.application] EZSP Radio board name: Series2
2021-06-08 15:07:08 INFO (MainThread) [bellows.zigbee.application] EmberZNet version: 6.9.2.0 build 256

@tube0013 tube0013 closed this as completed Jun 8, 2021
@MattWestb
Copy link
Owner

Looks great !!

I have putting one issue in https://github.com/zha-ng/EZSP-Firmware so they can also patching there firmware if they like.

@MattWestb
Copy link
Owner

I was trying patching one s37 NCP image with tokens and flashing it = OK.
Was doing one GBL crate with the same original s37 file but with different tokens and flashing it from the boot loader and it was not loading the tokens (= the old tokens was still there not updated).
So Silab have blocking updating the manufacture tokens with OTA and is only possible flashing one s37 file with token added or one token file direct with SWD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants