Register 3 Posted August 19, 2013 Share Posted August 19, 2013 Hi, Is there a way to detect the package type (const, define or value to read) to know which type of 2553 is running the program? I need to change pin assignment like P2.0 which is 8 for 20 pins and 10 for 28 pins package. Regards, Quote Link to post Share on other sites
spirilis 1,265 Posted August 19, 2013 Share Posted August 19, 2013 You should be able to use the defined constants like P2_0 in Energia, and it should be correct for the chip you're using since they're defined in custom header files for each chip type. Quote Link to post Share on other sites
roadrunner84 466 Posted August 20, 2013 Share Posted August 20, 2013 Not really, you can distinguish different types, but not different packages. Some documents even say that the very same die is used in the different packages. If you really need to, you could upload a firmware that sets high (or low) a certain pin, which is only available on the larger of the packages. If you then probe that pin (from your programmer) you could determine whether that pin does or does not exist in the chip currently programmed. Then conditionally upload on or the other firmware. Quote Link to post Share on other sites
Register 3 Posted August 20, 2013 Author Share Posted August 20, 2013 Hi, Thanks for the answer, where do I saw where are defined the different const like, can't put my hand on MSP430.h. When you probe a pin you can detect if it exist or you have to wire that pin to detect it ? Regards, Quote Link to post Share on other sites
roadrunner84 466 Posted August 20, 2013 Share Posted August 20, 2013 You'll need to wire the pin to detect it. But you could wire it to (for example) the Rx pin on the debugger's UART, then you would be able to detect it when using a script. If the UART pin is space (1) the line will report it to be idle, when the line is mark (0) for at least 10 bit times the line will report frame error. So you could upload one firmware for a frame error, and the other for an idle line. For such a script, use anything like, bash, power shell or python. This script will first upload the "set a pin" firmware, then read the Rx UART line and then flash a conditional firmware using the command line tools provided by TI. tripwire and Register 2 Quote Link to post Share on other sites
cde 334 Posted August 20, 2013 Share Posted August 20, 2013 Use bootstrapping. By that, I mean a single high value resistor tied to a spare pin, high or low. Any project where the 28 pin device is used, the resistor should tie the line high, your code reads it on boot, then ignores it the rest of the time it is running code. The 20 pin would have a resistor tied to ground. Or you could skip the resistor and tie the pins directly to vcc/gnd as long as you are sure you never set that pin as an output. (The resistors provide some level of idiot-proofing). This works on spare gpio pins, and can even be used later as an output (with the resistor!), an led output (again with the resistor), or a button input (again, with the resistor). Of course, this is a hardware level runtime method of defining boot options, not a compile-time or programming level. tripwire 1 Quote Link to post Share on other sites
spirilis 1,265 Posted August 20, 2013 Share Posted August 20, 2013 Find your Energia install and look for the "variants" directory. There is a pins_arduino.h or pins_energia.h file for each chip type I think. edit: Hmm, there is just a "launchpad" variant and I don't think it specifically has 28-pin G2553 support. On my Mac it's in /Applications/Energia.app/Contents/Resources/Java/hardware/msp430/variants/launchpad/pins_energia.hSent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
David Bender 28 Posted August 20, 2013 Share Posted August 20, 2013 Pin assignment really is anything you want it to be. For my 28pin G2553 board, I kept the LaunchPad assignments and just added another set of pins for P3. I added some energia support here if you want to take a look: https://github.com/analog10/Energia/blob/master/hardware/msp430/variants/dosocho/pins_energia.h The board itself is here: https://analog10.com/store/BOB-G2553-28.html Quote Link to post Share on other sites
Register 3 Posted August 20, 2013 Author Share Posted August 20, 2013 Hmm maybe I could create a program which just write a value in flash memory segment, run it on 28 pins packages before loading my main program in which i could test this value to detect the package and change assignments accordingly. cde 1 Quote Link to post Share on other sites
curtis63 5 Posted May 1, 2016 Share Posted May 1, 2016 The solution to detecting pin count can be found on Stack Exchange at the following location: http://electronics.stackexchange.com/questions/228082/how-do-you-programmatically-detect-pin-count-on-an-msp430g2553 spirilis and cde 2 Quote Link to post Share on other sites
spirilis 1,265 Posted May 1, 2016 Share Posted May 1, 2016 The solution to detecting pin count can be found on Stack Exchange at the following location: http://electronics.stackexchange.com/questions/228082/how-do-you-programmatically-detect-pin-count-on-an-msp430g2553 Neat! (Summary: set higher pins' PxOUT then read PxIN to see if it took effect) Quote Link to post Share on other sites
B@tto 51 Posted May 1, 2016 Share Posted May 1, 2016 But it does not solve completely the problem. I had this one porting F5510 which exist in different packages : some peripheral like USCI_B0 and A0 are simply not available in tiny package, but well define in the descriptor, so I had to trick Energia to get a compilation without error. More, I had to change SPI library to set up SPI on B1 and not B0. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.