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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.