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.

CC2540DK: Over-the-Air (OTA) demo, peripheral not working

Part Number: CC2540DK
Other Parts Discussed in Thread: CC2540, BLE-STACK

Hello,

I am trying to just get the OTA demo working with the CC2540DK Dev kit.  I have carefully followed the instructions of the BLE Developer's Guide for Over-the-Air Download for CC254x (http://processors.wiki.ti.com/images/8/82/OAD_for_CC254x.pdf), sections 9 through 11.

The Peripheral is not working (advertising, running image A or B ...)?  The LCD screen only says (what I suspect is the SmartRF05 default):

TexasInstruments

SmartRF05 EB

CC2540

I did not do the "super hex" as suggested in the Guide but instead programmed the BIM, then Img_A, then Img_B.  I copied the .hex off after every step, and comparing the three images it seems like what you would expect.  Also, just for kicks I cycled power and let it run just to see what would happen.  At every stage, I saw the exact same LCD message.

The board appears dead.  The joystick doesn't do anything.  The OAD_manager running in the Central (which does seem to act like the SimpleBLE demo) and the BLE scanner on my cell phone do not see advertisements from the Peripheral.

I think either:

1. The BIM isn't running

2. The BIM is running but it doesn't think Img_A or Img_B are valid, so it doesn't run either one

Any help appreciated,

Dave

  • Hi David,

    from the description you provided, it seems the EM board has not been properly programmed, otherwise it would have shown the message "OAD manager" on the display. Can you describe the steps you took for programming the board?

    Lenio
  • Thanks Lenio,

    The OAD Manager (a.k.a. Central) appears to be working fine, although the LCD doesn't say "OAD Manager" instead it says "BLE Central".

    I want to focus on the target (a.k.a. Peripheral) first because obviously nothing will happen without it.  I read the hex file off the part, examined the mapping and it looks to me like BIM, ImgA and ImgB are all there where they are supposed to be.
    I can debug the BIM (single step through the program) somewhat.  In function main(), after the first call to HalFlashRead(), crc[0] = 33211 and crc[1] = 65535.  Since crc[0] != crc[1] the BIM won't launch Img_B, but instead executes crcCheck().  I cannot step through crcCheck() because the BIM is highly optimized.  But I am fairly certain that  the entire body of crcCheck() is skipped (failing the first 'if') because I am not hitting the RESET inside the function.  Thus I have to conclude crcCalcDMA() is not returning the expected CRC.  Same thing happens for Img_A.
    So basically the BIM wakes up, rejects both images, and goes to sleep, LCD remains unchanged.  (IMHO it would be more useful to go into an infinite LED blinky pattern instead of going to sleep)
    I confirmed that the CRC words for Image A and Image B are the same in the programmed part as they are in the originally-compiled .hex files for each.  Section 8.4.2 of the Guide says the IAR compiler calculates each image CRC and places it at the beginning of the image -- perhaps the IAR compiler is not calculating CRC the same as the crcCalcDMA() function in BIM?
    As far as the programming steps, I followed the Guide as closely as possible, sections 9 and 10.
    If anyone has insight to how to fix this crc issue I'd love to hear it
    Dave

  • Since my last post I’ve learned quite a bit. There are four ways to calculate CRC, thus the CRC method has to be set in the compiler/linker AND the BIM, and they have to agree to calculate CRC in the same way.

    Compiler/linker:

    Guide Section 8.4.1 says “the image CRC is calculated by the IAR compiler” and it looks to me like Linker directives are setting it up. In the IAR Embedded Workbench, Project->Linker->Checksum dialog is all grayed-out because the “Fill unused code memory” box is not checked. So that dialog is not being used. Instead, in the project .xcl file (linker command line file, \common\cc2540\cc254x_f256_imgA.xcl), I found this:

    -J2,crc=8005,=0804-_BANK7_END

    Which according to the IAR Linker Reference Guide, defines how the checksum is to be generated:
    - ‘2’ is the number of bytes in the checksum result
    - ‘crc’ sets the Polynomial method of CRC calculation
    - ‘8005’ is the polynomial seed
    - ‘0804…’ is the range over which to calculate the checksum (Image A in this case)

    BIM Firmware:

    The way BIM calculates CRC is not clear to me, but following the function calls I don’t see where CRC is being set up the same way.  In crcCalcDMA() I do see a comment “CRC seed of 0x0000” which concerns me.  I don't find "8005" anywhere in the project.

    To prove my theory, I made a copy of the BIM and neutered the CRC check by commenting out the first two ‘if’ lines in main() in bim_main.c (4 lines total). Now this version of BIM will launch straight into Image B without checking CRC first. Lo and behold, Image B now runs, with "BLE Peri-B" appearing on the LCD and advertising packets showing on my sniffer.

    Could it be that the SimpleBLE demo project is out of synch with the OTA demo project? Perhaps SimpleBLE has evolved ahead while OTA didn’t?

    What is the CRC method being employed by BIM? -- then I could change the ImgA/ImgB linker command to match, for example.

  • Hello,

    What BLE-stack version are you using?
  • In a completely unrelated event, my hard drive died Friday.  So I don't know for sure, I may know tomorrow if my techs can recover any data.  I downloaded whatever was on the TI site about 4 weeks ago -- from the link you sent me it looks like it would have been v1.4.2 of 07-JUN-2016.  

    My computer should be repaired and returned to me tomorrow -- if they are not able to recover data I will have to build the project all over again.

    I heard a rumor there is a new version of BT stack out for 254x, v1.4.2.2, is this true?  If so where do I get it, or should I?

    Dave

  • Update: the day before my hard drive failed:

    The Peripheral is working (with my modified bootloader that does not CRC check image B)
    The OAD Manger is working

    Still no OAD image transfer. According to the Developer's Guide for Over Air Download for CC254x, you use Serial Bootloader Demo tool on your PC to load the new Image B over serial cable into the CC2540 module that is running OAD Manager. I do that and the file transfers. OAD manager finishes and shows "OAD chars Found!". Then guide tells you to begin scanning by pressing joystick up, and connecting to the Peripheral. Step 11.10 (on page 11) then says when connection is made, the OTA transfer will automatically begin.

    However, my boards aren't doing anything, they just sit there. The joystick on the OAD manager acts pretty much like the SimpleBLE demo, in that you can start scan, close connection and so on. Otherwise I/ve tried everything on both boards and nothing initiates the OAD transfer.

    I've spent a little time in the source trying to see where this automatic action is supposed to occur, but it is not clear.
  • I just discovered that on the BT Stack download page, if you select v1.4.2 what you actually get is 1.4.2.2. How long has this been true?
  • What's more, when you download v1.4.2, you get v1.4.2.2, and yet line six of the README.txt file says "BLE-Stack(tm) Version 1.4.2". So again, when was v1.4.2.2 released? What changed?