Hi Mark,
My routine is simple, follows below:
if (inicia!=1){
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(2 * SEC), E_MYEVENT);
inicia =1;
}
while ( fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH )) { // check input queue
switch ( ucInputMessage[MSG_SOURCE_TASK] ) { // switch depending on message source
case TIMER_EVENT:
if (ucInputMessage[MSG_TIMER_EVENT] == E_MYEVENT)
{
enviaARP();
a=0;
for (a = 0; a <= 10; a++)
{
if (Ethernet_handle!=0)
{enviaPKG();}
}
uTaskerGlobalStopTimer( OWN_TASK, E_MYEVENT );
uTaskerGlobalMonoTimer( OWN_TASK, (DELAY_LIMIT)(2 * SEC), E_MYEVENT );
}
I created an event that occurs in 2 to 2 seconds and if found sends a data packet. Below the function that sends the packet:
void enviaPKG(void)
{
static unsigned int lengh1 = 60;
static unsigned char * ptr = 0;
unsigned int usPortNr = 1000;
unsigned char meuIP[4] = { 192,168,0,121};
unsigned char teste[] =
{
0x08, //ETH.TYPE
0x00,
0x00,
0x01,
0x08,
0x00,
0x06,
0x04,
0x00,
0x01,
0x01,
0x08,
0x06,
0x00,
0x01,
0x08,
0x00,
0x06,
0x04,
0x00,
0x01,
0x08,
0x00,
0x06,
0x04,
0x00,
0x01,
};
// Aloca memoria para pacote
ptr = uMalloc(lengh1);
/* Monta o pacote */
// Dst = MAC do CG
uMemcpy(ptr, &meuIP, MAC_LENGTH);
// Src = MAC da gerencia
uMemcpy(ptr+6, network.ucOurMAC, MAC_LENGTH);
// ethernet type
uMemcpy(ptr+12, &teste, sizeof(teste));
// dados
uMemcpy(ptr+22, network.ucOurMAC, MAC_LENGTH);
uMemcpy(ptr+28, network.ucOurIP, IPV4_LENGTH);
// Zera os demais bytes do pacote
uMemset (ptr+34, 5, 60-34);
fnWrite(Ethernet_handle, ptr, lengh1);
fnWrite(Ethernet_handle, 0, 0);
}
I Follow the steps in another post but did not understand the problem. My "view memory" is in Attached, Can you help?