Writing to LPC54628 EEPROM through J-Link

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

Writing to LPC54628 EEPROM through J-Link

2,028件の閲覧回数
Leo11
Contributor I

Hi,

I am trying to write to EEPROM without involvement of CPU, as it provides a convenient way of preparing devices. I am erasing the flash memory and trying to write to the EEPROM via a J-Link.

I have tried different scenarios to understand what the problem can be. First of all, I can successfully write to EEPROM from the CPU (i.e. when using the SDK). I can also write to the EEPROM by J-Link when I keep the clock and power configurations that CPU sets. However, I am not able to write to the EEPROM when I attempt to erase and reset the CPU and do all the required power/clock configurations through J-Link. I was wondering if anyone can point what configuration I am missing.

Here is a pseudocode showing how I communicate to J-Link to configure the device and write to the EEPROM. In the last line, the bit never gets set indicating an unsuccessful write to the EEPROM (or probably the fact that something has not been configured properly). Can you check whether I am doing the configuration correctly?

 

ADDRESS_AHBCLKCTRL0     = 0x40000200
ADDRESS_MAINCLKSELA     = 0x40000280
ADDRESS_MAINCLKSELB     = 0x40000284
ADDRESS_SYSPLLCLKSEL    = 0x40000290
ADDRESS_AHBCLKDIV       = 0x40000380
ADDRESS_SYSPLLCTRL      = 0x40000580
ADDRESS_SYSPLLNDEC      = 0x40000588
ADDRESS_SYSPLLPDEC      = 0x4000058C
ADDRESS_PDRUNCFG0       = 0x40000610
ADDRESS_PDRUNCFGCLR0    = 0x40000630

ADDRESS_PRESETCTRL0     = 0x40000100
ADDRESS_PRESETCTRLSET0  = 0x40000120
ADDRESS_PRESETCTRLCLR0  = 0x40000140

ADDRESS_CMD             = 0x40014000
ADDRESS_RWSTATE         = 0x40014008
ADDRESS_WSTATE          = 0x40014010
ADDRESS_CLKDIV          = 0x40014014
ADDRESS_INTSTAT         = 0x40014FE0
ADDRESS_INTSTATCLR      = 0x40014FE8

ADDRESS_EEPROM_BASE     = 0x40108000


# Clock configurations for main_clk
# Select Free running oscillator (FRO) 12 MHz for main clock source
write_word(ADDRESS_PDRUNCFGCLR0, 1 << 4)  # Ensure FRO is running
write_word(ADDRESS_MAINCLKSELA, 0)
write_word(ADDRESS_MAINCLKSELB, 0)

# System clock and AHB clock control register
ahbclkctrl0 = read_word(ADDRESS_AHBCLKCTRL0)
write_word(ADDRESS_AHBCLKCTRL0, ahbclkctrl0 | (1 << 9))  # Enable EEPROM

# Set EEPROM peripheral reset
write_word(ADDRESS_PRESETCTRLSET0, (1 << 9)) # Reset
--> Wait until bit 9 in ADDRESS_PRESETCTRL0 is set
write_word(ADDRESS_PRESETCTRLCLR0, (1 << 9)) # Clear the reset
--> Wait until bit 9 in ADDRESS_PRESETCTRL0 is cleared

# Set EEPROM clock
write_word(ADDRESS_CLKDIV, 3)

# Set the wait states for read and write
write_word(ADDRESS_RWSTATE, 0x00000A0A) 
write_word(ADDRESS_WSTATE, 0x000A0A0A)  

# Write
write_word(ADDRESS_INTSTATCLR, 1 << 2)  # Clear program operation finished interrupt status
eeprom_address = ADDRESS_EEPROM_BASE
write_word(eeprom_address, b"\x01")
write_word(ADDRESS_CMD, 0x00000110)  # Trigger an erase/program operation
--> Wait until bit 2 in ADDRESS_INTSTAT is set

 

 

 

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

2,009件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Leo11,

 About this question, I think you can ask from Segger, the support team know this well.

https://www.segger.com/ 

 

BR

Alice

0 件の賞賛
返信

1,998件の閲覧回数
Leo11
Contributor I

Thanks for your reply!

I don't believe the problem is related to J-Link. It is about configuring the MCU for writing to EEPROM without using the SDK. I have simplified the code sample in my original question to make easier to read.  My guess is that there is a configuration step I am missing and for that reason my write to the EEPROM address range and triggering a write/erase operation through register `0x40014000` do not result in the data being written to the EEPROM. Can you please confirm whether I am doing the initial configuration correctly? 

0 件の賞賛
返信

1,967件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Leo,

Sorry I'm not very understand the J-link command well. If you have question about the using SDK driver write EEPROM, or some detail EEPROM issue , I think I can help you.

 

BR

Alice

0 件の賞賛
返信