• AVR Freaks

Hot!W5500 Lib on dsPIC33, CORCONbits

Author
newmelon
New Member
  • Total Posts : 14
  • Reward points : 0
  • Status: offline
2018/12/19 03:50:38 (permalink)
0

W5500 Lib on dsPIC33, CORCONbits

Hey all,
 
So I am currently working with the W5500 Module from Wizchip on a dsPIC33E with the XC16 on MPLAB X. I am using the Wizchip Library. (github.com/Wiznet/ioLibrary_Driver)
 
 
Problem :
In the file wizchip_conf.h I always get an error on line 255 (github.com/Wiznet/ioLibrary_Driver/blob/master/Ethernet/wizchip_conf.h)
by
union _IF 
{
..
}IF;

Compiler says: " error: expected identifier or '(' before '.' token "
If I look closely what is behind the _IF, I am coming to the SFR : CORCONbits.IF, which tells if the Integer or Fractional Mode should be used. I just don't get why this SFR is used as a namespace for the union ?
 
What can I do to solve the problem? If I use another random name I get link errors. Am I maybe thinking wrong? Would appreciate some hints.
 
Lot of thanks,
newmelon
 
 
#1

7 Replies Related Threads

    MBedder
    Circuit breaker
    • Total Posts : 6823
    • Reward points : 0
    • Joined: 2008/05/30 11:24:01
    • Location: Zelenograd, Russia
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2018/12/19 06:44:18 (permalink)
    0
    Just because the _IF is already defined as a bit name of the corresponding CORCON bit in the processor header file:
    /* CORCON */
    #define _IF CORCONbits.IF
    ...

    #2
    newmelon
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2018/12/19 06:50:45 (permalink)
    0
    MBedder, Yeah thats what I said: "..If I look closely what is behind the _IF, I am coming to the SFR : CORCONbits.IF"
     
    But whats the solution to my problem?
    #3
    MBedder
    Circuit breaker
    • Total Posts : 6823
    • Reward points : 0
    • Joined: 2008/05/30 11:24:01
    • Location: Zelenograd, Russia
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2018/12/19 07:31:28 (permalink)
    5 (1)
    Just undefine the _IF symbol in the header file (comment out the line I quoted above) provided you do not reference the CORCONbits.IF as just _IF nowhere in your code.
    post edited by MBedder - 2018/12/19 08:45:19
    #4
    newmelon
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2018/12/23 06:57:13 (permalink)
    0
    YES!! Lot of thanks MBedder! I wondered what the relation between the CORCON and the Ethernet should be, but yeah there is simply no one.
    Thank you, wish you a Merry Xmas!
     
     
    #5
    oliverb
    Super Member
    • Total Posts : 258
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2020/01/02 08:14:23 (permalink)
    0
    FWIW is it possible to use MPLAB X "refactoring" to change the name of the union, to avoid having to run with a hacked header file.
    Alternatively can you "#undef" it in the wiznet header?
     
    Incidentally:
    How well did this work out? I'm interested in PIC to Ethernet and the W5500 seems to offer a lot of functionality compared to the ENC28J60 but I looked at ioLibrary_Driver and I couldn't see where the platform-specific stuff went?
    #6
    marcov
    Super Member
    • Total Posts : 258
    • Reward points : 0
    • Joined: 2006/10/08 01:59:40
    • Location: Eindhoven, NL.
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2020/01/02 15:52:59 (permalink)
    0
    w5500 works great, I use it for simple UDP communication between a PC and multiple boards using various pics. I started cutting down the microchip stack (with w5200 plugins) to UDP only, and then gradually redid nearly every part asynchonously using DMA and BEN, while also converting to W5500.  This summer we took the first boards into production
     
    I also had the same stack working with pic32mk, but decided not to pursue that platform, so canned it.  Currently it is dspic33e MU series only, but in the past I had it working on MC510 and pic24 (the one that came with the original explorer32, I did most of the refactoring on that board) Instead I started with dspic33c, but we got quite busy this year, so I only have a basic two channel (bidi) DMA test there yet.
     
    Below is my flow chart using w5500 register names. Receive and Send packets, and discard is some periodic furthering of the pointers (every 2k). With short paths it is useful to this not too often.
     
    I have 100us wall time for a MU814 for the receive+send trajectories below(iow the moment the W5500 raises an interrupt till the confirmation that the answer has gone out), of which about 10us is actual processing, most of that is protocol decoding of the receive package (multi level select) and construction of a meaningful answer. I mostly work with short packets (5-20 bytes) received and answered.  
     

    #7
    marcov
    Super Member
    • Total Posts : 258
    • Reward points : 0
    • Joined: 2006/10/08 01:59:40
    • Location: Eindhoven, NL.
    • Status: offline
    Re: W5500 Lib on dsPIC33, CORCONbits 2020/01/02 15:55:50 (permalink)
    5 (1)
    The dspic33c is promising because
     
    (1) it supports faster SPI.
    (2) it doesn't have breaks between units (byte/word) in DMA transfers
     
    #8
    Jump to:
    © 2020 APG vNext Commercial Version 4.5