News:

;) This forum is the property of Proton software developers

Main Menu

CWrite to Flash not working

Started by kladogen, Nov 13, 2025, 01:03 PM

Previous topic - Next topic

kladogen

Hi, I'm trying to write to flash using CWrite but it does not seem to work. What am I doing wrong?

Symbol SN_LENGTH        3

Dim Pnter As Word
Dim lp As Byte
Dim SN As Flash8 = "AK!", 0
Dim SerString[SN_LENGTH] As Byte

Pnter = SN      ' Get the address of the serial number in Flash
For lp=0 To SN_LENGTH-1
    HRSIn SerString[lp]
    CWrite Pnter+I, [SerString[lp]]
    HRSOut SerString[[lp]]
Next

HRSOutLn "S/N set to :"
For lp=0 To SN_LENGTH-1
     HRSOut CRead8 SN[lp]
Next

trastikata

Writing in FLASH requires the corresponding page to be erased before you can write in it. Then to write in FLASH you have to send a full page. Between erase and write there must be the appropriate delay or you have to monitor some registers.

Note that often page erase size differs from page write size.