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

Activation keys for RF430FRL152H and MSP430L092 compatibility. #86

Open
travisgoodspeed opened this issue Jul 4, 2019 · 3 comments
Open

Comments

@travisgoodspeed
Copy link

Howdy y'all,

I ran into some trouble using mspdebug on an RF430FRL152H chip. This chip is weird in that it is low voltage and in that it uses 4-wire JTAG but not SBW, so I used the modern (black) MSP-FET and an RF430FRL152HEVM board, which includes level conversion to 3V logic. Sadly it works in UniFlash and CCS, but not in mspdebug.

The root cause seems to be that mspdebug is always sending an activationKey of zero to DeviceHandleMSP430::identifyDevice(). According to chipinfo.db, the RF430FRL152H and a few other chips require alternate activation keys, such as 0x5aa55aa5, 0xffffffff and 0xa55aa55a. A single chip requires 0xdeadbabe.

% cat chipinfo.db| grep -i activation | grep -v 00000000
                        .activation_key = 0x5aa55aa5,
                        .activation_key = 0xffffffff,
                        .activation_key = 0xa55aa55a,
                        .activation_key = 0xffffffff,
                        .activation_key = 0x5aa55aa5,
                        .activation_key = 0xffffffff,
                        .activation_key = 0xa55aa55a,
                        .activation_key = 0xffffffff,
                        .activation_key = 0x5aa55aa5,
                        .activation_key = 0xffffffff,
                        .activation_key = 0xa55aa55a,
                        .activation_key = 0xffffffff,
                        .activation_key = 0x5aa55aa5,
                        .activation_key = 0xffffffff,
                        .activation_key = 0xa55aa55a,
                        .activation_key = 0xffffffff,
                        .activation_key = 0xdeadbabe,
                        .activation_key = 0xffffffff,

When the connection fails, it does with Error 5, Unknown Device.

% mspdebug tilib                  
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.13.0.601 Copyright (C) 2013 TI, Inc.

Using new (SLAC460L+) API
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: ttyACM0
MSP430_Initialize: ttyACM0
Firmware version is 31400000
MSP430_VCC: 3000 mV
MSP430_OpenDevice
tilib: MSP430_OpenDevice: Unknown device (error = 5)
tilib: device initialization failed
% 

A temporary workaround is to patch DLL430_v3/src/TI/DLL430/DeviceHandleMSP430.cpp in libmsp430 so that the activationKey is forced to an acceptable value.

int32_t DeviceHandleMSP430::identifyDevice (uint32_t activationKey, bool afterMagicPattern)
{
        const bool assertBSLValid = (activationKey == 0x20404020);

        #warning This is an ugly temporary fix.  Don't use it.
        //activationKey=0x00000000; //Default, doesn't work for the RF430.                                                                                                                                                                        
        //activationKey=0x5aa55aa5; //Works                                                                                                                                                                                                       
        activationKey=0xa55aa55a;   //Also works                                                                                                                                                                                                  
        //activationKey=0xffffffff; //Doesn't work.                                                                                                                                                                                               
        //activationKey=0xdeadbabe; //Doesn't work.                                                                                                                                                                                               

        printf("Identifying device for activation_key=%lx\n", activationKey);
...

With this ugly patch to libmsp430 in place, we can connect to the chip at the expense of breaking all other chips.

% mspdebug  tilib                 
MSPDebug version 0.25 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2017 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Chip info database from MSP430.dll v3.13.0.601 Copyright (C) 2013 TI, Inc.

Using new (SLAC460L+) API
MSP430_GetNumberOfUsbIfs
MSP430_GetNameOfUsbIf
Found FET: ttyACM0
MSP430_Initialize: ttyACM0
Firmware version is 31300601
MSP430_VCC: 3000 mV
MSP430_OpenDevice
Identifying device for activation_key=a55aa55a
Identifying device for activation_key=a55aa55a
Got memory.
MSP430_GetFoundDevice
Device: RF430FRL152H (id = 0x0182)
2 breakpoints available
MSP430_EEM_Init
Chip ID data:
  ver_id:         81e7
  ver_sub_id:     0000
  revision:       9a
  fab:            55
  self:           5555
  config:         22
  fuses:          55
Device: RF430FRL152H [FRAM]
...

Type "help <topic>" for more information.
Use the "opt" command ("help opt") to set options.
Press Ctrl+D to quit.

(mspdebug) 

I'm not quite sure what the proper way to fix this issue is, but I hope that these details are helpful. Perhaps libmsp430 needs to be given an explicit model number, or an extra flag is needed somewhere?

Cheers from Knoxville,

--Travis

@dlbeer
Copy link
Owner

dlbeer commented Jul 5, 2019 via email

@travisgoodspeed
Copy link
Author

It would be rather inconvenient to demand the chip's model number before the fact, especially for projects like my GoodWatch whose firmware can run on more than one model number. Perhaps it will be good enough to make "DEVICE_UNKNOWN" the default?

I hope to have time this weekend to come up with a clean fix for you. Quick experiments last weekend with your suggested fix didn't seem to work, but I didn't have time then to investigate it further.

@dlbeer
Copy link
Owner

dlbeer commented Jul 13, 2019 via email

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