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

Wrong flash size read if chip is DEBUG_LOCKED #29

Open
ReDetection opened this issue Jan 24, 2019 · 3 comments
Open

Wrong flash size read if chip is DEBUG_LOCKED #29

ReDetection opened this issue Jan 24, 2019 · 3 comments

Comments

@ReDetection
Copy link

ReDetection commented Jan 24, 2019

Hello again.

According to the cc_info output, my CC2541 chip has 16kb flash (looks similar to #1). In the datasheet however it's stated only 128kb and 256kb versions and markings on the chip itself tell me I have 256kb.

What is recommended way to find, verify and fix the issue?

@ReDetection
Copy link
Author

(output of cc_info)

INFO: Found a CC2541 chip on /dev/cu.usbserial-A70051tV

Chip information:
      Chip ID : 0x4113
   Flash size : 16 Kb
    Page size : 2 Kb
    SRAM size : 1 Kb
          USB : No

Device information:
 IEEE Address : 000000000000
           PC : 0000

Debug status:
 [ ] CHIP_ERASE_BUSY
 [ ] PCON_IDLE
 [X] CPU_HALTED
 [ ] PM_ACTIVE
 [ ] HALT_STATUS
 [X] DEBUG_LOCKED
 [X] OSCILLATOR_STABLE
 [ ] STACK_OVERFLOW

Debug config:
 [ ] SOFT_POWER_MODE
 [ ] TIMERS_OFF
 [ ] DMA_PAUSE
 [ ] TIMER_SUSPEND

@ReDetection
Copy link
Author

ReDetection commented Jan 25, 2019

OK, according to datasheet:

When the debug-lock bit, DBGLOCK, is set to 0 (see Table 3-5), all debug commands except CHIP_ERASE, READ_STATUS, and GET_CHIP_ID are disabled. The status of the debug-lock bit can be read using the READ_STATUS command (see Section 3.3.2).

So that explains why I got only chip id and statuses. After chip erase (./cc_write_flash.py --erase with any hex in the --in= parameter, even dump from ./cc_read_flash.py would work just fine) everything is back to normal and reporting correct flash size 🎉

I think maybe it's a bad idea to try to read some particular register out of the chip if it's known to be debug locked. Would suggest to early exit if it's debug locked.

@ReDetection ReDetection changed the title CC2541 16Kb? Wrong flash size read if chip is DEBUG_LOCKED Jan 25, 2019
@skandragon
Copy link

It might be nice if there was a way to do this through the command, like --erase --empty-flash or something.

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