Hi. I'm trying to understand the Pic32 (a decade of familiarity with Pic16 and Pic18). I got myself an Ethernet Starter Kit. The demos run, and I have been able to edit them. So I tried to get two stacks working together. I then proceeded merging the TCPIP demo and the USB MSD demo. The latter just looks for a pendrive and when it sees it a simple text file gets written. The TCPIP integrates a basic http webserver. By themselves I'm able to run them. I merged the source files, integrating the USB stack calls in the main loop after the TCPIP stack calls. Fact is the compilation goes through but upon running, code gets stuck. Initialization goes through until the MAC init, at line 238 of ETHPIC32IntMac.c there is this line
if(EthDescriptorsPoolAdd(EMAC_TX_DESCRIPTORS, ETH_DCPT_TYPE_TX, _MacAllocCallback, 0)!=EMAC_TX_DESCRIPTORS)
this one apparently fails and I have no clue why. EMAC_TX_DESCRIPTORS are defines, but ETH_DCPT_TYPE_TX is nowhere to be found, as well as the EthDescriptorsPoolAdd function. Fact is they are nowhere to be found even in the demo project that works!
After that the code falls down to the main exception handler
void _general_exception_handler(unsigned cause, unsigned status) { Nop(); Nop(); }
codes are
cause = 0x10800034 status = 0x00100003
which I can't find anywhere. Now the exception handler description suggests that a read/write operation was issued on a NULL pointer, or that the stack was overflowed.
But the function looks to be asking for memory allocation, and infact it's a calloc that fails. But then even increasing the HEAP size doesn't make it. The project compiles, it runs without getting stuck, but every function calling on the MAC interface fails. As if the pointer is wrong or there is no MAC interface instanced.
I really don't know where to look. Can you suggest me a course of action?
Thanks Claudio