So I am completely defeated with the assignment I am currently working on. I am taking a networking with micro controllers class and basically the goal of the class is to make our micro controller dev boards (STK600 w/ ATMega2560) in a network card. We are going to be using the USART to talk with a PC script in Python and eventually we will hopefully have a network between computers using our dev boards as the interface. Anyway I think that is enough background for now.
Where I am stuck at is the creation of a buffer in order to store the received packets from the computer. Right now we are only sending simple char arrays and can make use of the \0 character which C terminates each string with. The packets we have to create must have a header which for fight now must only contain the length of the payload and a last field which indicates that the incoming packet will complete the transmission. The payload can range anywhere from 1 - 255 bytes.
So to start off I have defined two structures, header (which contains the last and length fields) and pkt (which will include the payload and the header) both members of the pkt structure are pointers one to the header structure one to the hardcoded payload. Right now I just created a char array of 255 characters including the null character.
We are only allowed to used the transmit and receive complete interrupts so the micro is not wasting time sitting in an ISR or function polling the UDREn flag to determine when the UDR is ready.
So what I am having a hard time with is creating a buffer which I can set up to let the interrupts take care of the rest as well as how to transfer that information in its appropriate structure so the higher level functions and analyze what was received.
I'm not looking for code just maybe some suggestions to look into I am willing to do the research but I am completely overwhelmed and don't know where to begin.
Where I am stuck at is the creation of a buffer in order to store the received packets from the computer. Right now we are only sending simple char arrays and can make use of the \0 character which C terminates each string with. The packets we have to create must have a header which for fight now must only contain the length of the payload and a last field which indicates that the incoming packet will complete the transmission. The payload can range anywhere from 1 - 255 bytes.
So to start off I have defined two structures, header (which contains the last and length fields) and pkt (which will include the payload and the header) both members of the pkt structure are pointers one to the header structure one to the hardcoded payload. Right now I just created a char array of 255 characters including the null character.
We are only allowed to used the transmit and receive complete interrupts so the micro is not wasting time sitting in an ISR or function polling the UDREn flag to determine when the UDR is ready.
So what I am having a hard time with is creating a buffer which I can set up to let the interrupts take care of the rest as well as how to transfer that information in its appropriate structure so the higher level functions and analyze what was received.
I'm not looking for code just maybe some suggestions to look into I am willing to do the research but I am completely overwhelmed and don't know where to begin.