kscheff / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
11 stars 9 forks source link

Unable to store program on flash #13

Closed peleshenko closed 5 years ago

peleshenko commented 5 years ago

Steps to reproduce:

  1. Download latest code(tested several branches and initial code from Tim)
  2. Change flag to work without 32KHz crystal
  3. Build code with IAR Workbench IDE 10.30.1 to hex file
  4. Convert hex file to bin with hex2bin utility
  5. Flash HM-10 (CC2541) by cc-loader

Actual result:

It looks like firmware can't write flash. I've spent some time trying to fix this issue by initializing flash, but without much success. Any ideas?

kscheff commented 5 years ago

The master branch is outdated, see the other branches for latest code. If IAR version 9.30.1 vs. 10.30.1 makes any difference is unknown.

peleshenko commented 5 years ago

I really appreciate the work you have done. However it's quite unusual for me to close issues when we still have no solution :) I've tried several branches and even initial repository, so maybe the issue is in IAR version, but there is no easy way to get IAR v 930.1.

Could I ask you to make a build (hex file) of any working branch but with XOSC32K_INSTALLED=FALSE flag on your environment?

kscheff commented 5 years ago

I closed the the issue, since the MASTER branch is outdated. As long as the other braches are not merged we can leave it open here.

Here are the binaries based the on the configuration BlueBasic-D1 from the latest Feature_SNV_IMG_148K branch with XOSC32K_INSTALLED=FALSE. In this branch the I2C, SPI and WIRE are in favour of SNV not enabled. Further the BASIC program space is 16KB and is located inside IMG_B area, thus the program gets overwritten by any IMG_B update. I use the MacOS complied BlueBasic interpreter in Xcode to tokenise the BASIC program and merge it into the IMG_B binary and recalculate the crc via https://github.com/kscheff/crc16. Thus its getting a one-wash update from the App side, no more fiddling which BlueBasic Interpreter Version fits to which BlueBasic program. The IMG_B could be increased by the now unused 8K old storage area, but this would loose compatibility to already deployed systems. The IMG_A BasicLoader limits the size to 148KB and in my deployment the IMG_A is factory resident and the pages are locked. For new projects I recommend to utilise the 8K and modify the areas and page pointers accordingly in both images.

Archiv.zip

peleshenko commented 5 years ago

Thank you very much it's working. I think there is something with IAR version or maybe with IMG_A/IMG_B, I'm working with CC2541 only 3 days, so I do not completely understand chip architecture. That is a prototype of bicycle speed sensor, so I need only counter implementation for now. Hope interrupts will work as expected. Thank you once more!