Hello all,
We are using PIC33EP256GM310.
I am only responsible for TCP/IP communication part of the software.
Ethernet IC is ENC28J60 and INT pin is directly connected to pin56 (RPI[color=52) of PIC33EP256GM310.
I like to use ENC28J60 in interrupt level.
here is the some definitions
Code: Select all
void enableinterrupts(void)
{
/* enable level 1-7 interrupts */
/* no restoring of previous cpu ipl state performed here */
intcon2bits.gie = 1;
return;
}
Code: Select all
void disableinterrupts(void)
{
/* disable level 1-7 interrupts */
/* no saving of current cpu ipl setting performed here */
intcon2bits.gie = 0;
return;
}
Code: Select all
void initinterrupts(void)
{
intcon1bits.nstdis = 1; /* interrupt nesting disabled here */
iec1bits.int1ie = 0; /* disable int1 interrupt */
ipc5bits.int1ip = 7; /* highest priority */
intcon2bits.int1ep = 1; /* edge polarity ( 1 rising, 0 falling edge ) */
iec1bits.int1ie = 1; /* enable int1 interrupt */
ifs1bits.int1if = 0; /* reset int1 interrupt flag */
return;
}
main while loop is like that
Code: Select all
while (1) {
asm clrwdt;
Net_Ethernet_28j60_doPacket(); // process incoming Ethernet packets
if ( sock->state == 3 ) {
if (flagset == 1) {
Net_Ethernet_28j60_startSendTCP(sock); // put a ram string into enc28j60 buffer , and transfer immediately
flagset = 0 ;
}
Delay_ms(1000);
}
}
I also do pps mapping like that
Code: Select all
pps_mapping([color=52, _INPUT, _INT1) ;
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_PRI_1, _SPI_PRESCALE_SEC_4, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_IDLE_2_ACTIVE);
and I write the desired values to the EIE and read it to verify.
Code: Select all
Net_Ethernet_28j60_writeReg(EIE,0x80+0x40+0x08);
EthernetInterruptEnableRegister = Net_Ethernet_28j60_readReg(EIE);
if (EthernetInterruptEnableRegister == 0xC8 ) {
led_ylw = 1;
}
furthermore, yellow led is activated.
I sent HTTP request to the ENC28J60,
but nothing happens.
what should I do ??
full project file is attached.