[ABANDONED] Flashing MediaTek MT7697D chip firmware, with jlink, swd protocol.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] Flashing MediaTek MT7697D chip firmware, with jlink, swd protocol.

    We have a product with MT7697 as the main MCU.
    We are using UART to flash the firmware, it works great, just a bit on the slow side.
    Considering trying to use swd with a jlink we tried several projects, including openOCD, we could not get any of them to work.
    Then we tried all the tools available from jlink.
    We were able to read from the MCU using jFlash without any issue.
    Now the weird part is that when we use jFlash Light it “claims” that the flash process was successful, yet the chip is not flashed.

    Our end goal is to use the J-Link Commander for the flashing process.

    Any advice will be highly appreciated.


    Our attempt at flashing using the commander
    JLink.exe" -device MT7697D -CommandFile commandFile.jlink

    This is the JLINK command file

    si 1

    speed 1000

    Log "MyLogFile.log"
    mem 0x00079000, 0xFF

    mem 0x00089000, 0xFF

    w4 0x8300f050,0x76371688

    w4 0x8300f050,0x76371688

    w4 0x8300f050,0x76371688

    w4 0x20000000,0x76877697

    loadbin project.bin 0x00089000
    w4 0x8300f050,0x76371688

    w4 0x8300f050,0x76371688

    w4 0x8300f050,0x76371688
    mem 0x00000000, 0xFF

    mem 0x00010000, 0xFF

    mem 0x00079000, 0xFF

    mem 0x00089000, 0xFF

    q


    This is the log output

    T1D0C 000:039.421SEGGER J-Link V7.58 Log File

    T1D0C 000:039.658DLL Compiled: Nov4 2021 16:28:06

    T1D0C 000:039.665Logging started @ 2021-11-22 14:33

    T1D0C 000:039.672 - 39.676ms

    T1D0C 000:040.208 JLINK_ExecCommand("device=MT7697D", ...).

    T1D0C 000:049.568XML file found at: C:\Program Files\SEGGER\JLink\JLinkDevices.xml

    T1D0C 000:050.199C:\Program Files\SEGGER\JLink\JLinkDevices.xml evaluated successfully.

    T1D0C 000:090.791Device "MT7697D" selected.

    T1D0C 000:093.222 - 53.005ms returns 0x00

    T1D0C 000:093.267 JLINK_EnableLog(...)

    T1D0C 000:093.276 - 0.012ms

    T1D0C 000:093.578 JLINK_GetEmuCaps()

    T1D0C 000:093.621 - 0.047ms returns 0xB8EA5A33

    T1D0C 000:093.652 JLINK_TIF_GetAvailable(...)

    T1D0C 000:094.353 - 0.710ms

    T1D0C 000:094.372 JLINK_TIF_Select(JLINKARM_TIF_SWD)

    T1D0C 000:096.285 - 1.921ms returns 0x00

    T1D0C 000:096.565 JLINK_IsConnected()

    T1D0C 000:096.581 - 0.019ms returns FALSE

    T1D0C 000:096.612 JLINK_SetSpeed(1000)

    T1D0C 000:096.986 - 0.382ms

    T1D0C 000:097.017 JLINK_Connect()

    T1D0C 000:097.936InitTarget() start

    T1D0C 000:097.991J-Link Script File: Executing InitTarget()

    T1D0C 000:103.393Enabling debug access to device

    T1D0C 000:107.084Failed to enable debug access to device

    T1D0C 000:107.773InitTarget() end

    T1D0C 000:170.775InitTarget() start

    T1D0C 000:170.831J-Link Script File: Executing InitTarget()

    T1D0C 000:178.711Enabling debug access to device

    T1D0C 000:183.726InitTarget() end

    T1D0C 000:186.114Found SW-DP with ID 0x2BA01477

    T1D0C 000:192.096DPIDR: 0x2BA01477

    T1D0C 000:193.401Scanning AP map to find all available APs

    T1D0C 000:195.527AP[1]: Stopped AP scan as end of AP map has been reached

    T1D0C 000:196.847AP[0]: AHB-AP (IDR: 0x24770011)

    T1D0C 000:200.678Iterating through AP map to find AHB-AP to use

    T1D0C 000:203.360AP[0]: Core found

    T1D0C 000:204.587AP[0]: AHB-AP ROM base: 0xE00FF000

    T1D0C 000:206.219CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)

    T1D0C 000:207.427Found Cortex-M4 r0p1, Little endian.

    T1D0C 000:309.669-- Max. mem block: 0x00002BB8

    T1D0C 000:310.418CPU_ReadMem(4 bytes @ 0xE000EDF0)

    T1D0C 000:311.750CPU_WriteMem(4 bytes @ 0xE000EDF0)

    T1D0C 000:313.180CPU_ReadMem(4 bytes @ 0xE0002000)

    T1D0C 000:315.620FPUnit: 6 code (BP) slots and 2 literal slots

    T1D0C 000:315.708CPU_ReadMem(4 bytes @ 0xE000EDFC)

    T1D0C 000:316.909CPU_WriteMem(4 bytes @ 0xE000EDFC)

    T1D0C 000:318.027CPU_ReadMem(4 bytes @ 0xE0001000)

    T1D0C 000:319.140CPU_WriteMem(4 bytes @ 0xE0001000)

    T1D0C 000:320.227CPU_ReadMem(4 bytes @ 0xE000ED88)

    T1D0C 000:321.323CPU_WriteMem(4 bytes @ 0xE000ED88)

    T1D0C 000:322.400CPU_ReadMem(4 bytes @ 0xE000ED88)

    T1D0C 000:323.486CPU_WriteMem(4 bytes @ 0xE000ED88)

    T1D0C 000:325.283CoreSight components:

    T1D0C 000:327.200ROMTbl[0] @ E00FF000

    T1D0C 000:327.265CPU_ReadMem(64 bytes @ 0xE00FF000)

    T1D0C 000:329.178CPU_ReadMem(32 bytes @ 0xE000EFE0)

    T1D0C 000:331.447[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7

    T1D0C 000:331.517CPU_ReadMem(32 bytes @ 0xE0001FE0)

    T1D0C 000:333.579[0][1]: E0001000 CID B105E00D PID 003BB002 DWT

    T1D0C 000:333.646CPU_ReadMem(32 bytes @ 0xE0002FE0)

    T1D0C 000:335.826[0][2]: E0002000 CID B105E00D PID 002BB003 FPB

    T1D0C 000:335.890CPU_ReadMem(32 bytes @ 0xE0000FE0)

    T1D0C 000:340.576[0][3]: E0000000 CID B105E00D PID 003BB001 ITM

    T1D0C 000:340.649CPU_ReadMem(32 bytes @ 0xE0040FE0)

    T1D0C 000:342.948[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU

    T1D0C 000:343.114 - 246.114ms returns 0x00

    T1D0C 000:343.180 JLINK_GetIdData(pIdData)

    T1D0C 000:344.060pIdData->ScanLen=4

    T1D0C 000:344.120

    T1D0C 000:344.148pIdData->NumDevices=1

    T1D0C 000:344.187

    T1D0C 000:344.214pIdData->aId[0]=0x2BA01477

    T1D0C 000:344.252

    T1D0C 000:344.278pIdData->aIrRead[0]=0

    T1D0C 000:344.317

    T1D0C 000:344.343pIdData->aScanLen[0]=0

    T1D0C 000:344.381

    T1D0C 000:344.407pIdData->aScanRead[0]=0

    T1D0C 000:344.446

    T1D0C 000:344.471 - 1.305ms

    T1D0C 000:344.549 JLINK_GetMemZones(...)

    T1D0C 000:344.678 - 0.151ms returns 0

    T1D0C 000:344.731 JLINK_HasError()

    T1D0C 000:344.771 JLINK_CORE_GetFound()

    T1D0C 000:344.807 - 0.049ms returns 0xE0000FF

    T1D0C 000:345.321 JLINK_ReadMem(0x00079000, 0xFF Bytes, ...)

    T1D0C 000:345.431CPU_ReadMem(255 bytes @ 0x00079000)

    T1D0C 000:350.464Data:00 00 04 20 81 00 00 10 4D 20 00 20 4F 20 00 20 ...

    T1D0C 000:350.538 - 5.231ms returns 0

    T1D0C 000:350.582 JLINK_HasError()

    T1D0C 000:390.015 JLINK_ReadMem(0x00089000, 0xFF Bytes, ...)

    T1D0C 000:390.073CPU_ReadMem(255 bytes @ 0x00089000)

    T1D0C 000:394.951Data:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ...

    T1D0C 000:394.987 - 4.980ms returns 0

    T1D0C 000:395.011 JLINK_HasError()

    T1D0C 000:415.004 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 000:415.565CPU is running

    T1D0C 000:415.606CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 000:416.513 - 1.530ms returns 0 (0x00000000)

    T1D0C 000:419.790 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 000:419.829CPU is running

    T1D0C 000:419.858CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 000:420.877 - 1.103ms returns 0 (0x00000000)

    T1D0C 000:421.980 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 000:422.019CPU is running

    T1D0C 000:422.048CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 000:423.038 - 1.074ms returns 0 (0x00000000)

    T1D0C 000:424.148 JLINK_WriteU32_64(0x20000000, 0x76877697)

    T1D0C 000:424.650CPU is running

    T1D0C 000:424.681CPU_WriteMem(4 bytes @ 0x20000000)

    T1D0C 000:425.727 - 1.595ms returns 0 (0x00000000)

    T1D0C 000:426.030 JLINK_IsHalted()

    T1D0C 000:427.077 - 1.063ms returns FALSE

    T1D0C 000:427.366 JLINK_Halt()

    T1D0C 000:434.751 - 7.414ms returns 0x00

    T1D0C 000:435.103 JLINK_DownloadFile()

    T1D0C 000:438.491Data:DF F8 58 D0 72 B6 04 F0 D1 F8 15 49 15 4A 16 4B ...

    T1D0C 000:439.067CPU_WriteMem(262144 bytes @ 0x00089000)

    T1D0C 003:736.885Data:44 68 D1 E9 00 01 3B F0 0B FF 20 60 10 BD 43 68 ...

    T1D0C 003:737.998CPU_WriteMem(262144 bytes @ 0x000C9000)

    T1D0C 007:036.315Data:AD F5 24 7D 0D F1 0C 09 01 93 00 23 46 93 47 93 ...

    T1D0C 007:037.846CPU_WriteMem(262144 bytes @ 0x00109000)

    T1D0C 010:336.004Data:A9 07 B1 80 BC 9D F7 7F 01 00 00 00 E0 9D F7 7F ...

    T1D0C 010:336.159CPU_WriteMem(19344 bytes @ 0x00149000)

    T1D0C 010:580.533 - 10145.485ms returns 0x00

    T1D0C 010:582.669 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 010:582.757CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 010:584.062 - 1.449ms returns 0 (0x00000000)

    T1D0C 010:585.054 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 010:585.142CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 010:586.402 - 1.399ms returns 0 (0x00000000)

    T1D0C 010:587.398 JLINK_WriteU32_64(0x8300F050, 0x76371688)

    T1D0C 010:587.486CPU_WriteMem(4 bytes @ 0x8300F050)

    T1D0C 010:588.850 - 1.502ms returns 0 (0x00000000)

    T1D0C 010:589.406 JLINK_ReadMem(0x00000000, 0xFF Bytes, ...)

    T1D0C 010:589.491CPU_ReadMem(255 bytes @ 0x00000000)

    T1D0C 010:594.808Data:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...

    T1D0C 010:594.890 - 5.499ms returns 0

    T1D0C 010:594.939 JLINK_HasError()

    T1D0C 010:634.868 JLINK_ReadMem(0x00010000, 0xFF Bytes, ...)

    T1D0C 010:634.958CPU_ReadMem(255 bytes @ 0x00010000)

    T1D0C 010:639.998Data:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...

    T1D0C 010:640.061 - 5.208ms returns 0

    T1D0C 010:640.103 JLINK_HasError()

    T1D0C 010:677.650 JLINK_ReadMem(0x00079000, 0xFF Bytes, ...)

    T1D0C 010:677.716CPU_ReadMem(255 bytes @ 0x00079000)

    T1D0C 010:682.589Data:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...

    T1D0C 010:682.632 - 4.989ms returns 0

    T1D0C 010:682.657 JLINK_HasError()

    T1D0C 010:701.846 JLINK_ReadMem(0x00089000, 0xFF Bytes, ...)

    T1D0C 010:701.904CPU_ReadMem(255 bytes @ 0x00089000)

    T1D0C 010:706.790Data:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...

    T1D0C 010:706.830 - 4.992ms returns 0

    T1D0C 010:706.855 JLINK_HasError()

    T1D0C 010:726.430 JLINK_IsOpen()

    T1D0C 010:726.470 - 0.048ms returns 0x01

    T1D0C 010:732.416 JLINK_Close()

    T1D0C 010:733.301CPU_ReadMem(4 bytes @ 0xE0001000)

    T1D0C 010:766.656 - 34.272ms

    T1D0C 010:766.702

    T1D0C 010:766.724Closed
  • Hi,

    If you select the MT7697D as the target MCU in J-Link Commander,
    you will have support for the ext. QSPI flash @ addr. 0x0800_0000.
    You can then read it via the "mem" commands and write it via the "loadbin" / "loadfile" commands.

    We will give it a shot here some time in January.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.