Forum: Mikrocontroller und Digitale Elektronik enc28j60 versendet Daten nur teilweise


von David B. (dave10)


Lesenswert?

Hallo,
ich habe auf meine µC eine webseite laufen. Bei dieser wird die 
Startseite (index.html) korrekt im Browser geladen, danach sollte sich 
ein Bild laden lassen, welches jedoch nicht vom Browser erhalten wird. 
Im Programm sieht der TCP/IP Stack gut aus (im Debugger stehen die 
richtigen Daten des TCP/IP Puffers). Jedoch bekomme ich die Daten im 
Browser nicht:
Hier meine senderoutine:
1
void enc28j60PacketSend(unsigned int len, unsigned char* packet) {
2
  //Check if space is availible ( Check if TXRTS is cleared )
3
  uint8_t timeout = 100;
4
  while((enc28j60Read(ECON1) & ECON1_TXRTS) && --timeout > 0){
5
    delay_ms(1);
6
  }
7
  
8
  // reset tx logic if TXRTS bit is still on
9
  if(timeout==0){
10
    //Errata #12 workarround, Reset transmit logic
11
    enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
12
    enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
13
  }
14
  
15
  // Set the write pointer to start of transmit buffer area
16
  enc28j60Write(EWRPTL, TXSTART_INIT&0xFF);
17
  enc28j60Write(EWRPTH, TXSTART_INIT>>8);
18
  // Set the TXND pointer to correspond to the packet size given
19
  enc28j60Write(ETXNDL, (TXSTART_INIT+len)&0xFF);
20
  enc28j60Write(ETXNDH, (TXSTART_INIT+len)>>8);
21
22
  // write per-packet control byte
23
  enc28j60WriteOp(ENC28J60_WRITE_BUF_MEM, 0, 0x00);
24
25
  // copy the packet into the transmit buffer
26
  enc28j60WriteBuffer(len, packet);
27
  
28
  //clear TXIF
29
  enc28j60WriteOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXIF);
30
  
31
  // send the contents of the transmit buffer onto the network
32
  enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRTS);
33
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.