• AVR Freaks

Hot!WINC1500 and PIC32MZ, without Harmony

Page: 123 > Showing page 1 of 3
Author
DougD
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2012/12/24 10:12:06
  • Location: 0
  • Status: offline
2018/10/05 09:23:57 (permalink)
0

WINC1500 and PIC32MZ, without Harmony

I want to use a WINC1500 module to connect a PIC32MZ to a TCP client.  The WINC1500 data sheet says it has an on-chip TCP/IP network stack to offload the (SPI-connected) MCU, and requires only a small footprint host driver on the MCU.

The problem is that I don't want to use Harmony, because it requires the PIC32MZ to host not only the TCP/IP stack, but also RTOS.  I don't know how to design my application to run properly while also sharing MCU resources with a TCP/IP stack and RTOS.  Unfortunately, the MLA libraries don't support PIC32MZ devices.

How can I do this, while avoiding Harmony if I can possibly help it?
 
Doug D.
#1

43 Replies Related Threads

    sidprice
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2017/12/25 17:01:27
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 10:45:25 (permalink)
    0
    You should be able to adapt the MLA driver, I did it for STM32F4. Just needs the SPI channel configured and the interrupt as far as I remember.
    Sid
    #2
    NKurzman
    A Guy on the Net
    • Total Posts : 17504
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 11:34:41 (permalink)
    0
    Harmony Requires??
    No it does not.
    Say no to the Stack and and use the SPI Driver. Do not like the SPI Driver? Then do not use that either. Use the Harmony PLib, or write to the registers your self.
    As far as Needing an RTOS ? I can’t speak for the WINC1500 but the Harmony “Driver” for the microchip modules only need an RTOS becuse it was thrown together sample code.
    Do not be afraid to only use parts of Harmony.
    #3
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11214
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 12:10:36 (permalink)
    0
    The MLA demos only require an interrupt, SPI, and a timer.  The Wi-Fi stack itself doesn't have any hardware dependencies.  It's straightforward to port to any PIC.
    #4
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 12:30:43 (permalink)
    0
    Thanks Sid--this gives me confidence that the WINC1500 will actually work as a stand-alone Network co-processor, rather than requiring a hosted stack.
    #5
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 12:32:56 (permalink)
    0
    Thanks for your reply.  I admit I'm new to Harmony, and that it's scared me plenty :-)  If I can avoid having to put the stack and RTOS on the PIC32MZ, then I can take another look at Harmony.

    I see that Harmony has a "WINC1500 Wi-Fi Driver Ethernet Mode Library", and a "WINC1500 Socket Mode Driver Library".  Is one of these the library I would use to interface with the WINC1500?  The PIC32MZ EF Curiosity board I bought has a MRF24 instead of a WINC1500, so I don't know where to start.
     
    #6
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 12:35:06 (permalink)
    0
    Thanks, that seems straight-forward enough.
     
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 17504
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/05 12:48:18 (permalink)
    0
    duplicate post deleted
    post edited by NKurzman - 2018/10/05 12:58:31
    #8
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/07 13:45:54 (permalink)
    0
    Hi,
     
    Are you saying if I say "no" to the TCP/IP Stack, that Harmony will automatically switch to using the TCP/IP stack located onboard the WINC1500 instead?  And that RTOS isn't needed for Harmony to interface with the WINC1500 either?
     
    I think it would take me too long to figure out how to modify an example to function without RTOS--that RTOS would be so deeply embedded into the WINC1500 Harmony example, that it would easier for me to learn how to use the MLA's ASF WINC1500 driver instead.  At least that way, I'd have an idea of what's going on.  With Harmony, I wouldn't have any idea what it's doing behind the scenes, and how that might impact my time-critical application.
     
     
    #9
    friesen
    Super Member
    • Total Posts : 2058
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/08 06:48:55 (permalink)
    0
    Rather than hijack the other thread, I am going to continue here.
     
    I posted my core code here - https://github.com/friesendrywall/MZ-WILC1000
     
    The only place cache is affected is the dma operations, but those could be completely disabled in the bsp files.  The ASF driver proper really has nothing to do with it.
     
    There are lots of examples that use posix style sockets, and they take very little porting to work with the FreeRTOS TCP stack.  Depending on the complexity of your project, FreeRTOS can be a help or a hindrance.  I balked at it until I really understood it, now I feel like it frees me to program in easier to understand chunks where each one does some specific thing.

    Erik Friesen
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 17504
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/08 07:11:27 (permalink)
    0
    No I am saying if you do not include the harmony stack the harmony will not include the harmony stack. You are then free to WRITE the code you need for WINC1500.
    Yes same as you would if Harmony did not exist. In fact you can include nothing in harmony and just let it configure the PIC and do the rest yourself. This is just one option.
    #11
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/08 11:15:08 (permalink)
    0
    Erik,
     
    Thanks very much for sharing your code.  As for freeRTOS, I think that learning, installing, and implementing an RTOS (and especially Amazon Web Service's freeRTOS, from what I've read elsewhere in these forums) would make this project much too difficult for me, so I'm going to do it without an RTOS.
     
    It's good to know I won't have to worry about the PIC32MZ's cache with the ASF driver.  I don't know I'll want to use DMA later or not.
     
    Best regards,
    Doug
     
    #12
    NKurzman
    A Guy on the Net
    • Total Posts : 17504
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/08 13:24:52 (permalink)
    0
    DougD
    Hi,
     
    Are you saying if I say "no" to the TCP/IP Stack, that Harmony will automatically switch to using the TCP/IP stack located onboard the WINC1500 instead?  And that RTOS isn't needed for Harmony to interface with the WINC1500 either?




    No I am saying if you say "no" to the TCP/IP Stack, that Harmony will not include it. This will allow YOU to write the code you need for the  WINC1500 instead.
    #13
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/15 10:59:17 (permalink)
    0
    Well, I've run some MLA Winc1500 demos for the PIC24F on my Explorer 16 board, and can merge their functionality into my application to do what I need.  As you've pointed out, these demos use the Atmel ASF driver files to control the native TCP/IP stack located on the WINC1500, using a PIC SPI interface.

    Now I'm trying to figure out how to port this to a PIC32MZ running on my Explorer 16/32 board.  The MLA's PIC24F demos include a number of files that are generated by Microchip Code Configurator (MCC):
        ext_int.c        ext_int.h
        interrupt_manager.c    interrupt_manager.h
        mcc.c            mcc.h
        pin_manager.c        pin_manager.h
        tmr1.c            tmr1.h
        traps.c            traps.h
        uart2.c            uart2.h

    Unfortunately, MCC doesn't support the PIC32MZ, so I can't simply include mcc.h.  I could modify the wf_mcu_driver_stub.c, bsp.c, and bsp.h files, but understanding and modifying the other fourteen MCC files seems a bit much.

    What is the best way for me to proceed with porting this to a PIC32MZ?  I might be able to use Harmony to configure the PIC32MZ's pins if I needed to, but I'd be reluctant to use it for much more than that.


    #14
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11214
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/15 11:16:58 (permalink)
    0
    There's very little code in all of those MCC files; it's mostly just boilerplate comments and initializing peripherals.  It's not too difficult to replace them.
    #15
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/15 11:58:49 (permalink)
    0
    Okay, if that's the way to do it, I'll proceed.  I just wanted to make sure I wasn't missing anything that would make it easier.
     
    Thanks.
    #16
    NKurzman
    A Guy on the Net
    • Total Posts : 17504
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/15 12:42:55 (permalink)
    0
    Most of those Files are Hardware specific and will not Port easily.
    #17
    DougD
    Junior Member
    • Total Posts : 97
    • Reward points : 0
    • Joined: 2012/12/24 10:12:06
    • Location: 0
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/15 13:27:33 (permalink)
    0
    That's what I'm worried about.  What options do I have if I don't want to host the TCP/IP stack or RTOS on the PIC32MZ?
     
    #18
    friesen
    Super Member
    • Total Posts : 2058
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/16 12:46:32 (permalink)
    0
    This will take some digging, and you still may be best off using ASF.
     
    Keeping hardware and software versions matched in winc1500 mode could be challenging in production.
     
    After the basic setup routines, the core thing you have to call is m2m_wifi_handle_events() which is the thread all the callbacks happen in.  This really needs to get set up to be called when the winc/wilc interrupt line goes low.  However, have to be thread safe on this, some m2m functions can't be interrupted.  For example, calling m2m_wifi_send_ethernet_pkt() ties up the SPI port, so you can't have it interrupted.
     
    You'll need to figure out what to do with nm_bsp_sleep()
     
    If you go wilc1000 mode you can remove the serial port update stuff, otherwise you'll need it so you can update the wilc1500 firmware if it doesn't match your software version.
     
    So pretty much you'll have to get some basic understanding of the code flow, its going to take a couple of days I'd say.

    Erik Friesen
    #19
    jyaron
    Super Member
    • Total Posts : 392
    • Reward points : 0
    • Joined: 2003/11/07 12:43:15
    • Status: offline
    Re: WINC1500 and PIC32MZ, without Harmony 2018/10/16 14:03:24 (permalink)
    0
    DougD
    Well, I've run some MLA Winc1500 demos for the PIC24F on my Explorer 16 board, and can merge their functionality into my application to do what I need.  As you've pointed out, these demos use the Atmel ASF driver files to control the native TCP/IP stack located on the WINC1500, using a PIC SPI interface.

    Now I'm trying to figure out how to port this to a PIC32MZ running on my Explorer 16/32 board.  The MLA's PIC24F demos include a number of files that are generated by Microchip Code Configurator (MCC):
       ext_int.c        ext_int.h
       interrupt_manager.c    interrupt_manager.h
       mcc.c            mcc.h
       pin_manager.c        pin_manager.h
       tmr1.c            tmr1.h
       traps.c            traps.h
       uart2.c            uart2.h

    Unfortunately, MCC doesn't support the PIC32MZ, so I can't simply include mcc.h.  I could modify the wf_mcu_driver_stub.c, bsp.c, and bsp.h files, but understanding and modifying the other fourteen MCC files seems a bit much.

    What is the best way for me to proceed with porting this to a PIC32MZ?  I might be able to use Harmony to configure the PIC32MZ's pins if I needed to, but I'd be reluctant to use it for much more than that.





    Stripping out the MCC files is pretty easy. I moved the dsPIC MLA UDP client/server apps to MPLAB8 in about a day. Just a big state machine with callbacks... good for the simple dumb node requirement I currently have.
    #20
    Page: 123 > Showing page 1 of 3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5