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.

How to change in header files, if neccessary - my hen and egg problem.

Other Parts Discussed in Thread: MSP430F413, MSP430F423, MSP430F427

 

As IDE I use is CCS v.4 and program in C.

On the schematics of MSP-TS430PM64 (the LCD-less board I have), I notice that the single LED on board – and the one I want to communicate with – is connected to pin 12. Pin 12 is via a jumper J6 -if closed- connected to the LED. If open it is connected to LCD. On my my board it is closed.

On the data sheet of MSP430F42x, the pin number 12 is only marked S0. It is used to connect a LCD and nothing else.

The simplest TI LED demo code, and presumably also valid?? for MSP430F42x MCUs is named fe410_1.c and goes like this:

//*****************************************************************************

// MSP-FET430P410 Demo - Software Toggle P5.1

//

// Description: Toggle P5.1 by xor'ing P5.1 inside of a software loop.

// ACLK = n/a, MCLK = SMCLK = default DCO

//

// MSP430F413

// -----------------

// /|\| XIN|-

// | | |

// --|RST XOUT|-

// | |

// | P5.1|-->LED

//

// M. Buccini

// Texas Instruments Inc.

// Feb 2005

// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.21A

//*****************************************************************************

#include <msp430x41x.h>

 

void main(void)

{

WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

P5DIR |= 0x02; // Set P5.1 to output direction

 

for (;;)

{

volatile unsigned int i;

 

P5OUT ^= 0x02; // Toggle P5.1 using exclusive-OR

 

i = 50000; // Delay

do (i--);

while (i != 0);

}

}

 

Here you note that msp430x41x.h is included, but changing it to msp430x42x.h doesn't matter. Further you notice that P5 is chosen as output pin connected to the LED. That is wrong. There is no such pin on msp430x42x, there are only P1 and P2. On MSP430F313 there you find a marking like this: S0 – 12 - P5.1/S0.

Probably found the designer of my board out designer found out that he wanted make use of this duality too.

But that causes problems in the code. At compilation I get following:

"../flashing.c", line 29: error: identifier "P5DIR" is undefined

"../flashing.c", line 35: error: identifier "P5OUT" is undefined

2 errors detected in the compilation of "../flashing.c".

If I change P5 to P2 it compiles! I get the following:

<Linking>

'Finished building target: flashing.out'

' '

Build complete for project flashing

It is also possible to load the program and run it:

MSP430: Program loaded. Code Size - Text: 74 bytes Data: 2 bytes, but of course the is no flashing LED.

I think I have to make some changes in msp430x41x.h, but I do not know how to open it and where exactly make the changes.

Can somebody post me a hint in the right direction.

 

  • Before changing anything, would you might indicating which specific device part number you are targeting?

    Secondly, which board are you using with that device?  Is it your own hardware, or the MSP-TS430PM64?

  • I think you are using MSP430F423, F423A, F425, F425A, F427, or F427A. You have a PCB that copied some of the “features” of the MSP-TS430PM64. It includes a jumper, an LED, and a resistor from pin 12 to ground. Am I correct?

    MSP-TS430PM64 is not specifically designed for MSP430F42x or F42xA. F42x or F42xA cannot use the featured LED at pin 12. This is because, as you already found out yourself, that for F42x or F42xA, pin 12 is for S0 only. There are many other 64-pin MSP430 chips that can drive an LED with pin 12. Even for those chips, you do not have to use pin 12 to drive an LED. That is why there is a jumper.

    The sample code you found is for F41x chips which has P5.1 at pin 12. There are other chips with P1.0 at pin 12. These sample codes need to be modified slightly to work with F42x or F42xA. And the hardware needs a modification too. Changing the header file alone will not do it.

    You can remove the jumper on your board and solder a wire from the LED side of that jumper to one of the unused P1 or P2 pins. And you can modify the sample code you found by changing P5.1 to the P1 or P2 pin you actually use. (This is in addition to change the header file to match the chip you use.)

    -- OCY

  • Yes, you are all through. It's clear now. Thanks.

    Perhaps you can you help me with next problem. It is from a Dannenberg example too:

     

    Need to know more about editing in the lnk_msp430f427l.cmd file.

    Using CCS latest version and C language. Trying to get something written 2004 in IAR Embedded Workbench Version:3.20A by Andreas Dannenberg running in CCS latest version and C language, after accomodations. Got stuck here, could need some help.

    Have been also been influenced by Vishal Nandanwar's post 05-07-2010. Despite that I get this error about a new “dark horse” .sysmem, which I do not know how to handle. I understand that I'm try to put something that has the with of 80 bytes of data into a segment that is only 70 bytes large...

     

    #pragma DATA_SECTION(CalMin,".infoA")

    static long CalMin;

    #pragma DATA_SECTION(CalMax,".infoA")

    static long CalMax;

     

    /*

    "../lnk_msp430f427.cmd", line 59: error: run placement fails for object

    ".sysmem", size 0x50 (page 0). Available ranges:

    RAM size: 0x400 unused: 0x46 max hole: 0x46

    MEMORY

    {

    .

    .

    RAM : origin = 0x0200, length = 0x0400

    /*

    INFOA : origin = 0x1080, length = 0x0080

    INFOB : origin = 0x1000, length = 0x0080

    */

    INFOA : origin = 0x1080, length = 0x008A

    INFOC : origin = 0x100A, length = 0x0076

    FLASH : origin = 0x8000, length = 0x7FE0

    .

    .

    }

    SECTIONS

    {

    .

    .

    .infoA :{} INFOA

    .infoC :{} INFOC

    .

    .

    }

    */ Further, I take it up here even if it's unrelated to the first problem: /*

    In the same example, I have come upon following

    for-loop:

    "for(i = 32; Output = 0; i; i--){} //BCD conversion, 32-bit"

    Never seen anything like this before. Does anyone have an idea of what it

    is supposed to perform? The only thing I understand is, that it is a very

    important LCD statement, otherwise he wouldn't have used in other demo programs,too.

    Besides, it throws following error msgs:"

    line 91: warning: use of "=" where "==" may have been intended

    line 91: warning: expression has no effect

    line 91:error: expected a ")".

    If I compile this altered statement (still see no meaning with it):

    for(i = 32; Output = 0; i--){}, I get this warning:

    line 91: warning: use of "=" where "==" may have been intended

    Anything that can shed light over this second problem is very welcome!

**Attention** This is a public forum