How write to CH552 data flash

OP (Company: CruzPro Ltd.) #7683926
Rate this post
useful
not useful

I would like so me help writing to CH552 data flash. I am able to write and read to/from standard flash memory but when I try to write to 0xC000 to 0xC0FF the CH552 reboots continuously.

I tried just reading from 0xC000-0xC0FF without writing and the CH552 still reboots continuously.

I have attached a text file showing how I try to write to data flash. This works OK if writing to flash below 16K.

Regards,

Bert

Attached files:
#7683932
Rate this post
useful
not useful

Bert V. wrote:

I tried just reading from 0xC000-0xC0FF without writing and the CH552 still reboots continuously.

reading the dataflsh does not work with movc, movc > 0x3FFF gives a reset

1
//flashaccess must be already activated
2
uint8_t ReadDataFlash(uint8_t addr, uint8_t *value)
3
{
4
   if((value) && (addr < 128))
5
   {
6
      ROM_ADDR = DATA_FLASH_ADDR | (addr < 1);
7
      ROM_CTRL = ROM_CMD_READ;
8
      if(ROM_STATUS & bROM_CMD_ERR) return 0xFE; // cmd error
9
      *value = ROM_DATA_L;
10
      return 0;                                  // success
11
   }
12
   return 0xFF;                                  // param error  
13
}

writefunction is similar to the above

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now