Reply by MohanDada May 31, 20032003-05-31
Hi,

Thanks a lot. The code is working perfectly.

Regards,
Mohan

--- In msp430@msp4..., "J.C. Wren" <jcwren@j...> wrote:
> This uses GCC to compile.
> 
> static void cmd_cfgerase (void)
> {
>    unsigned int oldWDTCTL;
>    unsigned int oldIE1;
> 
>    _DINT ();
>    oldWDTCTL = WDTCTL;
>    oldIE1 = IE1;
>    IE1 = 0;
>    WDTCTL = WDTPW | WDTHOLD;
> 
>    FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
>    FCTL1 = FWKEY | ERASE;
>    FCTL3 = FWKEY;
>    *(unsigned char *) 0x1000 = 0x00;
>    FCTL1 = FWKEY;
>    FCTL3 = FWKEY | LOCK;
> 
>    WDTCTL = FXKEY ^ oldWDTCTL;
>    IE1 = oldIE1;
>    _EINT ();
> }
> 
> static void cmd_cfgwrite (void)
> {
>    unsigned int oldWDTCTL;
>    unsigned int oldIE1;
>    unsigned int i;
>    const char *string = "This is a test";
>    unsigned int l = strlen (string);
> 
>    _DINT ();
>    oldWDTCTL = WDTCTL;
>    oldIE1 = IE1;
>    IE1 = 0;
>    WDTCTL = WDTPW | WDTHOLD;
> 
>    FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
>    FCTL1 = FWKEY | WRT;
>    FCTL3 = FWKEY;
> 
>    for (i = 0x1000; i < 0x1080; i++)
>       *(unsigned char *) i = string [i % l];
> 
>    FCTL1 = FWKEY;
>    FCTL3 = FWKEY | LOCK;
> 
>    WDTCTL = FXKEY ^ oldWDTCTL;
>    IE1 = oldIE1;
>    _EINT ();
> }
> 
> --John
> 
> On Thursday 29 May 2003 16:44 pm, MohanDada wrote:
> >  Hi,
> >
> >  Does any one have smaple module source to erase and write block 
of
> >  data into flash memory of MSP430 Segment A
(0x1000)and Segment
> >  B(0x1080).
> >
> >  Regards,
> >  Mohan D.
> >  mohan@c...
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >  .
> >
> >
> >
> >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.


Beginning Microcontrollers with the MSP430

Reply by Venkateswarlu Palle May 30, 20032003-05-30
DEAR ALL
can i use STE pin as a chip select pin for spi mode. otherwise what is use of
STE pin . and also max. speed  of SPI will work?
 


"J.C. Wren" <jcwren@jcwr...> wrote:
This uses GCC to compile.

static void cmd_cfgerase (void)
{
   unsigned int oldWDTCTL;
   unsigned int oldIE1;

   _DINT ();
   oldWDTCTL = WDTCTL;
   oldIE1 = IE1;
   IE1 = 0;
   WDTCTL = WDTPW | WDTHOLD;

   FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
   FCTL1 = FWKEY | ERASE;
   FCTL3 = FWKEY;
   *(unsigned char *) 0x1000 = 0x00;
   FCTL1 = FWKEY;
   FCTL3 = FWKEY | LOCK;

   WDTCTL = FXKEY ^ oldWDTCTL;
   IE1 = oldIE1;
   _EINT ();
}

static void cmd_cfgwrite (void)
{
   unsigned int oldWDTCTL;
   unsigned int oldIE1;
   unsigned int i;
   const char *string = "This is a test";
   unsigned int l = strlen (string);

   _DINT ();
   oldWDTCTL = WDTCTL;
   oldIE1 = IE1;
   IE1 = 0;
   WDTCTL = WDTPW | WDTHOLD;

   FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
   FCTL1 = FWKEY | WRT;
   FCTL3 = FWKEY;

   for (i = 0x1000; i < 0x1080; i++)
      *(unsigned char *) i = string [i % l];

   FCTL1 = FWKEY;
   FCTL3 = FWKEY | LOCK;

   WDTCTL = FXKEY ^ oldWDTCTL;
   IE1 = oldIE1;
   _EINT ();
}

--John

On Thursday 29 May 2003 16:44 pm, MohanDada wrote:
>  Hi,
>
>  Does any one have smaple module source to erase and write block of
>  data into flash memory of MSP430 Segment A (0x1000)and Segment
>  B(0x1080).
>
>  Regards,
>  Mohan D.
>  mohan@moha...
>
>
>
>
>
> Yahoo! Groups Sponsor
>
>
>
>
>
>
>
>
>
>  .
>
>
>
>  


Yahoo! Groups Sponsor

.



 

Catch all the cricket action. Download Yahoo! Score tracker




Reply by michelqv May 29, 20032003-05-29
There is a rar file in the Files area of this group.

Michel

--- In msp430@msp4..., "MohanDada" <mohandada@y...> wrote:
> Hi,
> 
> Does any one have smaple module source to erase and write block of 
> data into flash memory of MSP430 Segment A (0x1000)and Segment 
> B(0x1080).
> 
> Regards,
> Mohan D.
> mohan@c...


Reply by codemsp430 May 29, 20032003-05-29
hi mohan 

 In the TI website in the FET examples in C you can find two 
programs related to flash which i guess should clarify your 
doubts ,check with the accurate processor you are using 

bye
raghu



--- In msp430@msp4..., "MohanDada" <mohandada@y...> wrote:
> Hi,
> 
> Does any one have smaple module source to erase and write block of 
> data into flash memory of MSP430 Segment A (0x1000)and Segment 
> B(0x1080).
> 
> Regards,
> Mohan D.
> mohan@c...


Reply by J.C. Wren May 29, 20032003-05-29
This uses GCC to compile.

static void cmd_cfgerase (void)
{
   unsigned int oldWDTCTL;
   unsigned int oldIE1;

   _DINT ();
   oldWDTCTL = WDTCTL;
   oldIE1 = IE1;
   IE1 = 0;
   WDTCTL = WDTPW | WDTHOLD;

   FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
   FCTL1 = FWKEY | ERASE;
   FCTL3 = FWKEY;
   *(unsigned char *) 0x1000 = 0x00;
   FCTL1 = FWKEY;
   FCTL3 = FWKEY | LOCK;

   WDTCTL = FXKEY ^ oldWDTCTL;
   IE1 = oldIE1;
   _EINT ();
}

static void cmd_cfgwrite (void)
{
   unsigned int oldWDTCTL;
   unsigned int oldIE1;
   unsigned int i;
   const char *string = "This is a test";
   unsigned int l = strlen (string);

   _DINT ();
   oldWDTCTL = WDTCTL;
   oldIE1 = IE1;
   IE1 = 0;
   WDTCTL = WDTPW | WDTHOLD;

   FCTL2 = FWKEY | FSSEL1 | FSSEL0 | FN3 | FN1 | FN0;
   FCTL1 = FWKEY | WRT;
   FCTL3 = FWKEY;

   for (i = 0x1000; i < 0x1080; i++)
      *(unsigned char *) i = string [i % l];

   FCTL1 = FWKEY;
   FCTL3 = FWKEY | LOCK;

   WDTCTL = FXKEY ^ oldWDTCTL;
   IE1 = oldIE1;
   _EINT ();
}

--John

On Thursday 29 May 2003 16:44 pm, MohanDada wrote:
>  Hi,
>
>  Does any one have smaple module source to erase and write block of
>  data into flash memory of MSP430 Segment A (0x1000)and Segment
>  B(0x1080).
>
>  Regards,
>  Mohan D.
>  mohan@moha...
>
>
>
>
>
> Yahoo! Groups Sponsor
>
>
>
>
>
>
>
>
>
>  .
>
>
>
>  


Reply by MohanDada May 29, 20032003-05-29
Hi,

Does any one have smaple module source to erase and write block of 
data into flash memory of MSP430 Segment A (0x1000)and Segment 
B(0x1080).

Regards,
Mohan D.
mohan@moha...