This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

rl-tcpnet work with lan8720?

hi
i create board with lpc1788 and lan8720
i try send data with lan8720 and RL-TCPnet Library

#include <rtl.h>

U8 tcp_soc;
U8 soc_state;
BOOL wait_ack,tick;

U16 tcp_callback (U8 soc, U8 event, U8 *ptr, U16 par);
void send_data (void);
static void timer_poll ();

int main (void) {

init_TcpNet (); tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT, 0, 120, tcp_callback); soc_state = 0;

while (1) { main_TcpNet (); send_data (); }
}

void send_data (void) { static U8 rem_IP[4] = {192,168,0,6}; static int bcount; U32 max,i; U8 *sendbuf;

switch (soc_state) { case 0: tcp_connect (tcp_soc, rem_IP, 1000, 0); bcount = 0; wait_ack = __FALSE; soc_state = 1; return;

case 2: if (wait_ack == __TRUE) { return; } max = tcp_max_dsize (tcp_soc); sendbuf = tcp_get_buf (max); for (i = 0; i < max; i += 2) { sendbuf[i] = bcount >> 8; sendbuf[i+1] = bcount & 0xFF; if (bcount >= 32768) { soc_state = 3; break; } } tcp_send (tcp_soc, sendbuf, i); wait_ack = __TRUE; return;

case 3: if (wait_ack == __TRUE) { return; } tcp_close (tcp_soc); soc_state = 4; return; }
}

U16 tcp_callback (U8 soc, U8 event, U8 *ptr, U16 par) {

switch (event) {

case TCP_EVT_CONNECT:

soc_state = 2; break; case TCP_EVT_ACK:

wait_ack = __FALSE; break;

} return (0);
}

code not work and i can not ping device IP set in file NET_CONFIG.C

Parents Reply Children
No data