This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: When using ZNP from ZStack 3.0, I cannot pass MAC_Init() call

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK, CC-DEBUGGER

Hello TI team,

I have bought your CC2530 SoC included in Core2530 + Zb502 board from Waveshare. They also included Coordinator, EndDevice & Router.bin firmware files which I can upload using preloaded bootloader. All these files seem to work well, but I wanted to upgrade to ZStack 3.0 (provided firmware files are using older ZStack).

I installed ZStack 3.0 from your site and tried to compile project in C:\Texas Instruments\Z-Stack 3.0.2\Projects\zstack\ZNP\CC253x and successfully uploaded it to my Core2530+ZB502 using SerialBootTool via USB. Unfortunately this firmware does not work. I included some HAL_TURN_ON_LEDx/HAL_TURN_OFF_LEDx calls and discovered that MAC_Init() call from ZMacInit() function never ends.

It may be that it is because it is first LCALL being called or there is inifinite loop in this function (I don't have source code of it).

Modifications that I made:

- CFG1 is set to UART w/o reading the setting from P2_0 port (because this port is connected to KEY2 button on my board)

Instead of:

znpCfg1= ZNP_CFG1_SPI;

znpCfg0 = ZNP_CFG0_32K_OSC;

// Tri-state the 2 CFG inputs after being read (see hal_board_cfg_xxx.h for CFG0.)

P1INP |= BV(2);

P2INP |= BV(0);

P1_0 = 1;

I have:

znpCfg1 = ZNP_CFG1_UART;
znpCfg0 = ZNP_CFG0_32K_OSC;
// Tri-state the 2 CFG inputs after being read (see hal_board_cfg_xxx.h for CFG0.)
//P1INP |= BV(2);
//P2INP |= BV(0);
P1_0 = 1;

Is there anything else that I need to adjust for this specific board to work?

  • Does your Core2530 + Zb502 board from Waveshare contain serial boot loader? If not, I suppose you cannot use SerialBootTool to update the FW through UART.
  • Yes, it does contain bootloader. It seems to work similar to your original TI bootloader - porbably it is the same one.

    Boot-up looks like this:

    LED1 and LED2 are blinking for 40 seconds

    Pressing KEY1 is turning SoC into programming mode and Serial Boot Tool can connect

    Pressing KEY2 is starting the program on the chip

    I think that bootloader works correctly as I was adding code to turn leds on and off and I've seen leds light when launching the program. My changes to the code caused an immediate effect when I was updating firmware via Serial Boot Tool.

    The original firmware from Waveshare can even be used with Z-Tool, but the newer tool reports that ZStack version should be updated. When I upload the newer firmware, UART communication is dead (only 0 is printed when bootloader launches the program).

  • When you say you upload newer FW, do you build CC2530 ZNP-with-SBL project to get this newer FW?
  • Yes, when I build the project, output file is generated in dev\ directory. The file existed even before I built the project, but even downloading this original file did not work (Z-Tool could not find the device, no answer for ping on UART).
  • Do you generate ZNP bin to download from serial boot loader of your CC2530 module?
  • Yes, I tried both pregenerated file (as I mentioned in previous post) and to build it myself using the newest IAR Workbench. In the latter case path to generated BIN is printed at the end of the build in a popup. I use the same path to load file using SBT.

    Any clue why this specific function call from my initial question does not work? If you are in doubt if I generate BIN file correctly, can we verify it somehow?

  • I suspect your ZNP binary are not uploaded successfully. I suggest you to use CC Debugger to debug/trace it first.
  • I do not own CC debugger. Ok, I would like to verify If they are not uploaded correctly. My doubt is that I see LED light when I put HAL_TURN_ON_LEDx/HAL_TURN_OFF_LEDx macro calls in certain places in the code? Leds are not lighting up only if I put the code after MAC_Init() call in ZMacInit() function.

    So what else do I need to test to verify it is it uploaded correctly? Wouldn't SBT report an error in such case? Upload process looks correctly to me:

    1. I select file, COM port and other parameters and click "Load from file" (if I remember the button name correctly ;))
    2. SBT is trying to connect
    3. I press RESET button on ZB502 board, led1 and led2 are blinking
    4. I press KEY1. Only LED1 blinks, SBT starts to upload the file
    5. Progress bar on SBT is showing the progress, RX/TX leds are blinking
    6. SBT is finished, CC2530 is reset, led1 and led2 are blinking
    7. I press KEY2 to run the program
    8. Program is executed till MAc_init() call. All my changes to led lights, that I made in code since the last upload, are visible

  • I can not judge what’s wrong according to your descriptions. I suggest you to buy CC Debugger to debug/trace it.
  • Ambi,

    As this is a third party product, I also suggest getting a CC-Debugger in order to further assist debugging. I see that the waveshare guide also mentions you need the CC debugger for programming things such as the serial bootloader and allows you to debug further for issues like you're encountering now.

    Best,
    Sean
  • Hello Sean,

    Thanks for joining the discussion. I've just ordered CC Debugger. I hope to have some debuggng results next week.

  • Ok, so I bought CC-Debugger and downloaded Debug version of ZNP to my Core2530. It appeared that the problem no longer exists, so YK Chen could be right that pre-installed bootloader did not save firmware correctly. I also tried to install bootloader from ZStack 3.0.2 and it seems to work better - no issues when I use SerialBootTool to download the ZNP firmware w/o SB.

    Some hints what I had to do to make new z-stack work. I eventually connected P2_0 port to ground to switch from ISP to UART interface (instead of code changes from original post).

    Then reading data PC -> Core2530 worked correctly. To fix data writes from Core2530 to PC, I had to also connect P0_4 to ground.