Hello!
I would like to know how the general paged programming procedure works for the ATMEGA328PB. I have to write a programmer myself since I have to use a specific SPI interface or let's say the C# abstraction of that. I tried to figure these questions out starring at your source code, but it's just to complex of a project to be a quick help for me.
If no one has the time to help right now or this is too off topic just close this. :)
Is my understanding of the general Programming sequence that I got from the Datasheet right and if not where did I take the wrong turn?
(I'm using byte indices instead of words so the page size would by 128 bytes, and when I say byte index I mean relative to all the data I want tow write to the flash)
Put the MCU into programming mode
Write each Page by sending:
Write each byte of the page by sending:
INST[0] = 0x48, if the index of the byte even (Load Program Memory Page, Low byte)
INST[0] = 0x40, if the index of the byte is odd (Load Program Memory Page, High byte)
INST[1] = 0x0
INST[2] = the index of the byte relative to the current page divided by two (adr LSB)
INST[3] = the data byte (high/low data byte in)
send the write Instruction:
INST[0] = 0x4C (Write Program Memory Page)
INST[1] = byte index devided by two >> 8 (adr MSB)
INST[2] = byte index devided by two & 0xff
INST[3] 0x0
Poll RDY/BSY until Ready
If anyone find's any time to help I'd be grateful! Thx!
Hello! I would like to know how the general paged programming procedure works for the ATMEGA328PB. I have to write a programmer myself since I have to use a specific SPI interface or let's say the C# abstraction of that. I tried to figure these questions out starring at your source code, but it's just to complex of a project to be a quick help for me.
If no one has the time to help right now or this is too off topic just close this. :)
Is my understanding of the general Programming sequence that I got from the Datasheet right and if not where did I take the wrong turn?
(I'm using byte indices instead of words so the page size would by 128 bytes, and when I say byte index I mean relative to all the data I want tow write to the flash)
If anyone find's any time to help I'd be grateful! Thx!