Not able to write in flash of LPC18S37

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Not able to write in flash of LPC18S37

5,260件の閲覧回数
PranavKolte1
Contributor II

Hi
I am using lpc18s37 micro controller for development. I am trying to erase and write in flash using IAP method but not able to do so. Can anyone help me with this, below is the code that is written.

#if defined (__USE_LPCOPEN)

#if defined(NO_BOARD_LIB)

#include "chip.h"

#else

#include "board.h"

#include "chip.h"

#endif

#endif

 

#include <cr_section_macros.h>

 

// TODO: insert other include files here

#include "stdio.h"

#include "string.h"

 

#define START_ADDRESS 0x1B000000

#define END_ADDRESS 4096

 

// TODO: insert other definitions and declarations here

 

int main(void) {

 

#if defined (__USE_LPCOPEN)

// Read clock settings and update SystemCoreClock variable

SystemCoreClockUpdate();

#if !defined(NO_BOARD_LIB)

// Set up and initialize all required blocks and

// functions related to the board hardware

Board_Init();

// Set the LED to the state of "On"

Board_LED_Set(0, true);

#endif

#endif

 

 

// TODO: insert code here

// Board_Debug_Init();

 

uint32_t sector_end = START_ADDRESS + END_ADDRESS - 1;

Chip_IAP_PreSectorForReadWrite(START_ADDRESS, sector_end, IAP_FLASH_BANK_B);

Chip_IAP_EraseSector(START_ADDRESS, sector_end, IAP_FLASH_BANK_B);

uint32_t buffer[] = {0xFF, 0x01, 0x02, 0x03, 0xAA};

Chip_IAP_CopyRamToFlash(START_ADDRESS, buffer, sizeof(buffer));

 

while(1)

{

}

return 0 ;

}

ラベル(2)
0 件の賞賛
返信
6 返答(返信)

5,237件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PranavKolte1 

Recommend refer to "flashiap" demo under LPCopen.

If you still have question about it, please kindly let me know.

 

BR

Alice

5,221件の閲覧回数
PranavKolte1
Contributor II

Thank You for the help! I referred that and now able to do that.

Can yo please help me to write or erase in flash using ISP protocol. I am trying to build my own boot loader.

0 件の賞賛
返信

5,189件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PranavKolte1 

Your own second bootloader should use iap, not ISP. the ISP command is used for boot ROM.

In ISP mode, using ISP command. Can using Flash Magic tool on PC side.

 

BR

Alice

5,181件の閲覧回数
PranavKolte1
Contributor II

Hello @Alice_Yang

Can you pls point me to the detail documentation for regarding the ISP, IAP and BOOT ROM.

0 件の賞賛
返信

5,162件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @PranavKolte1 

Refer to User Manual for lpc18s37, Chapter 4: LPC18xx Boot ROM and Chapter 5: LPC18xx flash programming/ISP and IAP. I attach it for you.

 

BR

Alice

5,058件の閲覧回数
PranavKolte1
Contributor II

 

Hello @Alice_Yang 

I am trying to write Secondary Bootloader for LPC1823 microcontroller can you pls point me to the documentation regarding the secondary bootloader for LPC1823. I want to use USB0 in DFU mode for receiving data from PC.

0 件の賞賛
返信