I have a question about how to properly call an unsolicited UDP message to transmit while using the lwip stack.
I've read where the lwip stack should only be called using interrupts. All of the examples I've looked through show what look to be solicited messages meaning a Receive followed by a Transmit. (i.e. synchronized with the SysTick() Interrupt)
The operation I'm trying to implement is one where the application transmits ~ ever 4ms so the messages will be unsolicited. The messages could occur during the SysTick() Interrupt of the lwip stack or it could be on another interrupt. My question deals with properly calling one of these transmit operations using the lwip stack.
I have something working but I'm not sure it's done correctly. (i.e. entering lwip through the interrupt stack).
I'm using the udp_sendto() routine. This code is extremely difficult to determine how it operates so I can't tell if this routine is actually setting a flag such that the next time the lwipEtherNetIntHandler() is called it will see a Transmit operation or it's causing the transmission to occur during the routine.
Here is a dumbed down version of the code that I have working. I'm not getting any errors but I don't think this error will tell me if the lwip stack was used correctly. Can you tell me if I need to do anything special to ensure the transmission operation is utilizing the lwip stack correctly? (Hope this makes senses)
void Transmit_Dummy(void)
{
#define DUMMY_BUFFER_SIZE 38
struct pbuf *pTransmitBuffer;
uint32_t Dummy[DUMMY_BUFFER_SIZE];
volatile unsigned int ErrCode;
uint32_t DataSize;
DataSize = DUMMY_BUFFER_SIZE << 2;
//Allocate the pTransmitBuffer Size
pTransmitBuffer = pbuf_alloc(PBUF_TRANSPORT,DataSize,PBUF_RAM);
Dummy[0]=0x002CA800;
Dummy[1]=0x2C9A002C;
Dummy[3]=0x06002CA2;
Dummy[4]=0x002C1E00;
Dummy[5]=0x2AEC002A;
Dummy[6]=0xF4002A98;
Dummy[7]=0x0004FE00;
Dummy[8]=0x04FA002C;
Dummy[9]=0xF2002C9C;
Dummy[10]=0x002CE000;
Dummy[11]=0x2CFC002C;
Dummy[12]=0xD6002C0A;
Dummy[13]=0x002D6000;
Dummy[14]=0x2CC8002D;
Dummy[15]=0x2E002978;
Dummy[16]=0x0028D400;
Dummy[17]=0x34380029;
Dummy[18]=0xE4002A1C;
Dummy[19]=0x002A1C00;
Dummy[20]=0x29E40034;
Dummy[21]=0x380028D2;
Dummy[22]=0x00297800;
Dummy[23]=0x2CCC002C;
Dummy[24]=0x8E002CD0;
Dummy[25]=0x0005F400;
Dummy[26]=0x05FC002C;
Dummy[27]=0x48002EAE;
Dummy[28]=0x002AF200;
Dummy[29]=0x2B080029;
Dummy[30]=0xAC0028D8;
Dummy[31]=0x0028D800;
Dummy[32]=0x28AC002A;
Dummy[33]=0x08002AF2;
Dummy[34]=0x002EAE00;
Dummy[35]=0x0000002C;
Dummy[36]=0xE2002C04;
Dummy[37]=0x45444342;
//Copy the data to the payload
memcpy(pTransmitBuffer->payload, &Dummy[0],DataSize);
ErrCode = udp_sendto(pcb2, pTransmitBuffer,(ip_addr_t *)&g_ui32RemoteIPAddress,g_ui16RemotePort);
printf("\nErrorCode = ");
printf("%i\n",ErrCode);
printf("IPAddress = ");
DisplayIPAddress(g_ui32RemoteIPAddress);
printf("\nPort = ");
printf("%i",g_ui16RemotePort);
pbuf_free(pTransmitBuffer);
Thanks for your help,
Joe