How to access the flash outside the 64K of the MSP430F5438 microcontroller

Publisher:SparkCrafterLatest update time:2016-11-03 Source: eefocusKeywords:MSP430F5438  MCU  flash Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. In IAR's integrated development environment, select your project, right-click, and click options.

2. In the Target page, Data Model option, select Medium or Large in 4.
3. Explanation:
- Select SMALL to access only the space within 64K, and the space outside can only be accessed by internal functions
- Select Medium to access the space within 1M
- Select Large to access the entire space


1. F5XX 430X 
2. Select Large small medium. The effect is to change the number of bytes occupied by the pointer variable. The default pointer variable in IAR is 2 bytes. Select large to occupy 4 bytes, so the pointer can access addresses beyond the 64K range.
3. You can use IAR internal functions, */

void __data20_write_char (unsigned long __addr,
unsigned char __value);

void __data20_write_short(unsigned long __addr,
unsigned short __value);

void __data20_write_long (unsigned long __addr,
unsigned long __value);

unsigned char __data20_read_char (unsigned long __addr);
unsigned long __data20_read_long (unsigned long __addr);

 

 

 

 

How to operate the flash memory of 5438
I would like to ask about the flash memory operation of MSP430F5438. The code is shown below. Why does the fixed address of the flash memory not change?

Code:
void main(void)
{
 

  unsigned long SEGMENT = 0x20000ul;

  WriteFlash(SEGMENT);
  FlashErase(SEGMENT);

  while(1);

   
}Code:
//Erase Flash address: adr specifies address Y
void FlashErase(unsigned long pAddr)
{
  
  uchar * Flash_ptr = (uchar *)pAddr;                 
  
  _DINT();                                  
                                            
  while(BUSY & FCTL3);
  FCTL3 = FWKEY;                            
  FCTL1 = FWKEY+ERASE;                     
  *Flash_ptr = 0;                           
  while(BUSY & FCTL3);
  FCTL3 = FWKEY+LOCK;                       
  _EINT();
}Code:
//Write Flash address: adr specifies address,
void WriteFlash(unsigned long pAddr)
{
  _DINT();
  unsigned int i;
  uchar * Flash_ptr = (uchar *)pAddr;       
  while (FCTL3&BUSY);
  FCTL3 = FWKEY;                         
  FCTL1 = FWKEY+WRT;                       
  for(i = 0; i < 128; i++)
  {
    *(Flash_ptr++) = record1[i]; 
    while(!(WAIT & FCTL3));                 
  }
  while (FCTL3&BUSY);
  FCTL1 = FWKEY;                           
  FCTL3 = FWKEY+LOCK;                                        
  _EINT();
}

Keywords:MSP430F5438  MCU  flash Reference address:How to access the flash outside the 64K of the MSP430F5438 microcontroller

Previous article:LCD human-computer interaction data acquisition system
Next article:DS1302 MCU Program

Recommended ReadingLatest update time:2024-11-16 13:04

51 MCU Smart Home Remote Control
Real smart home, real remote control, mobile phone can control it with internet, WiFi traffic can be used Material: 1. MCU minimum system, MCU program 2. WiFi module (ESP8266) is normal, WiFi firmware 3. Android Gizwits official APP 4. Relay module This design has only been tested with 4 and 8 channels, and no more
[Microcontroller]
51 MCU Smart Home Remote Control
How to convert unsigned char to string in MCU
In single-chip microcomputers, numbers and characters are often used. In C, itoa function is used. C51 also has this function. However, the RAM of 8051 is very limited, so try to avoid using int type. Unsigned char is often used. It is still a bit wasteful to use itoa when it needs to be converted into a string. I sti
[Microcontroller]
IAR fully supports China Micro Semiconductor automotive grade BAT32A series MCU, helping to launch domestic automotive grade "core" products
IAR fully supports China Micro Semiconductor automotive grade BAT32A series MCU, helping to launch domestic automotive grade "core" products April 2023, Shanghai, China - IAR, the world's leading provider of embedded development software solutions and services, and China Microelectronics (Shenzhen) Co., Ltd., a w
[Embedded]
IAR fully supports China Micro Semiconductor automotive grade BAT32A series MCU, helping to launch domestic automotive grade
[MCU framework][AT command framework][Slave version] High cohesion and low coupling
main idea Takes the form __attribute__((used)) attribute((section ("atcmd"))) advantage: The output channels can be changed freely to realize three-party communication. Register AT commands, just write them into the module without coupling other files The following is an example of how to use it: test.c #include "at
[Microcontroller]
[MCU framework][AT command framework][Slave version] High cohesion and low coupling
51 MCU-Preliminary Preparation
1. Learning prerequisites The microcontroller needs to interact with programs, which requires you to master very basic C language knowledge first. Even if we explain the execution process of the program as detailed as possible, it will be difficult for students who have no C language knowledge foundation. So you mus
[Microcontroller]
51 MCU voice + temperature control source code
#include #define uchar unsigned char #define uint unsigned int volatile index; uchar a,b,c; //Define three variables. flying m; // uint teempr; // uint z,i; //************************************************★The following is the array of PWM modulation★******************************************************** //22
[Microcontroller]
The STC89C52 microcontroller lights up two digital tubes and can display a total of 11 numbers from 00 to 10.
Manual display #include reg52.h //Includes 51 header file #include intrins.h //Includes the shift standard library function header file #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection //Common cathode digital tu
[Microcontroller]
The STC89C52 microcontroller lights up two digital tubes and can display a total of 11 numbers from 00 to 10.
Design of LED outline display controller based on single chip microcomputer
LED guardrail tube, also known as Lide tube, is an advanced LED decorative lighting product. With red, green and blue LED as the light source, it uses microelectronics and digital technology, can perform color chasing, color transition gradient, grayscale change and seven-color change, and can produce a very rich co
[Microcontroller]
Design of LED outline display controller based on single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号