Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Tms470r1b1m flash f05 programming help!

Status
Not open for further replies.

stevenendlos

Newbie level 5
Joined
Jul 19, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,372
I'm using TMS470R1B1M F05 Flash and I'm trying erase, write & validate data onto the flash. i'm using IAR Embedded workbench IDE. Here's how my subroutine for write looks like looks like-

#include<stdio.h>
#include<stdlib.h>
#include <TexasInstruments/iotms470r1b1m.h>
#include <TexasInstruments/tms470r1b1m_bit_definitions.h>
#include <intrinsics.h>
# define buffer 0x000F0000 // to find out bank & sector value from the given flash address
# define random_address 0x0003f011 //some random address in flash for writing opreand
# include <string.h>

//////my inputs are 32 bit flash address, 32 bit source pointer, length)


//// void program_flash(uint32 *source_pointer, uint32 flashaddress, uint32 data_len) //my subroutine
void main ()
{
int flashaddress = 0x000f00ff; //temporary input
int sourceaddress = 0x02021292; ///temporary input
unsigned short int sector;
GCR |= FLCONFIG; //setting gcr
sector = (int) (buffer & flashaddress) >> 16; //finding out sector value
FMMAC2_bit.BANK = (int)((sector) /8) ; //assigning bank value to fmmac register

sector = (sector % 8); //since sector range is from 0-7
FMMAC1_bit.PROTL1DIS = 1; //setting bit
FMBSEA = sector; //.....sector value goes into fmbsea
FMPKEY = 0X1111; // write protection keys default(all 1's)
FMREGOPT &= READOTP; //clear the bit readotp


volatile int *dummy = (int *)random_address; //random address in flash memory
*dummy = 0x0010; //writing operand is sent to random adrress in flash memory

memcpy((void*)flashaddress,(void*)sourceaddress, 2); //copying halfword data at a time from source address to flash address

}



My question is-

1. How do I check the final result of the above operation? (writing pass or fail)

2. Anything wrong with the code?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top