Skip to content

Question: Serial programming procedure of ATMEGA328PB #1389

Closed Answered by blauertee
blauertee asked this question in Q&A
Discussion options

You must be logged in to vote

Thank's a lot, I got it to work. I'm just gonna share some pseudo code here, for anyone who is as confused as I was when starring at the Data Sheet or the avrdude source code.

(Pseudocode is ChatGPT generated from real code, cuz I can not post the former since I don't own it and don't have the time to write it myself.)

function ATMEGA328PBProgramFlash(fileData):
    constant pageSizeBytes = 128
    pageCount = roundUp(fileData.length / pageSizeBytes)
    loadHighByteInstruction = [0x48, 0x00, 0x00, 0x00]
    loadLowByteInstruction = [0x40, 0x00, 0x00, 0x00]
    writePageInstruction = [0x4C, 0x00, 0x00, 0x00]

    for pageIndex from 0 to pageCount - 1:
        startOffset = pageIndex * pag…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@blauertee
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by blauertee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #1388 on June 08, 2023 13:53.