How write to CH552 data flash

OP (Company: CruzPro Ltd.) #7683926

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

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

OP (Company: CruzPro Ltd.) #7685041

I figured that out :-)

I have been testing the DataFlash with an endurance test. The CH552 user manual states it's good for 10,000 writes. It's still working after over 200,000 write/read cycles.

Reply

A question of your own? This thread is over 2 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

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.