• AVR Freaks

Hot!Harmony V2 , PIC32MX / external flash IC programming through USB from PC

Author
JEGANATH
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2020/03/27 23:53:38
  • Location: 0
  • Status: offline
2020/06/26 04:56:28 (permalink)
0

Harmony V2 , PIC32MX / external flash IC programming through USB from PC

Hi
I'm  using PIC32MX795F512L custom  board with flash IC (W25Q128FV), i need to load 15MB bin file into flash IC through USB from my PC
 
Can I use Harmony USB CDC_COM_PORT_SINGLE demo for flash IC programming ?
 
post edited by JEGANATH - 2020/06/26 19:28:59
#1

13 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/26 20:17:11 (permalink)
    4 (1)
    Probably yes, but you wiol have to come up with your own scheme to put the data into packets specifying where in the FLASH they should go, and telling the PC when you are ready for the next packet.
    (Plainly you can't just let the PC send the data as fast as it can, you don't have enough RAM to buffer it all.)
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    JEGANATH
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2020/03/27 23:53:38
    • Location: 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/28 06:09:41 (permalink)
    0
    I have 4 questions
     
    1) In CDC how to implement Bulk transfer ?
    2) In USB maximum Buffer size is 64 Bytes ?, Can i able to increase the buffer size ?
    3) what is SET_LINE_CODINGGET_LINE_CODING and where to set these one ?
    4) Is Endpoint 0 is enough for both Communication and Data Interface if not how to set different endpoint ?
     
    Thanks in advance
    post edited by JEGANATH - 2020/06/28 06:10:57
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 18859
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/28 07:59:35 (permalink)
    4 (2)
    The CDC is going to simulate a serial interface like a UART. So you do not need to play with a The USB items.
    There should be a CDC example application.
    Look at that.
    #4
    JEGANATH
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2020/03/27 23:53:38
    • Location: 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/28 08:27:12 (permalink)
    0
    I'm new to this topic can u explain in brief @NKurzman
    I need to connect PC to PIC32 through USB for data transfer guide me how to implement it.
     
    Thanks in advance
    post edited by JEGANATH - 2020/06/28 18:33:44
    #5
    _pA89
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2017/06/06 12:39:37
    • Location: India
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/29 05:49:44 (permalink)
    4 (1)
    1. In CDC how to implement Bulk transfer ?
       There are 4 Transfer types in USB - {Control, Interrupt, Isochronous, Bulk},
       CDC has --- 2 Data Endpoints - Bulk IN, Bulk OUT,  1 Intterupt Endpoint
    2. NO, You need not have to worry of it as MPLAB Harmony Does the work
    3. SET_LINE_CODING, GET_LINE_CODING  are properties related to UART set {Communication Speed, Data Length, Parity Bit, Stop Bit Length} These settings wont effect your communication because everything happens in software
    4. Endpoint 0 is used for Control(pipe) - {Control, Configure, Status} Requests not Data Transfer -- Packet Lenght =64 Bytes - Full Speed Device

    Read: Section 27. USB On-The-Go (OTG) Family Reference Manual for PIC32MX
     
            
     
    case USB_DEVICE_CDC_EVENT_SET_LINE_CODING:
                // In this case, the application should read the line coding
                // data that is sent by the host. The application must use the
                // USB_DEVICE_ControlReceive function to receive the
                // USB_CDC_LINE_CODING type of data.
                
                USB_DEVICE_ControlReceive(usbDeviceHandle, &lineCoding, sizeof(USB_CDC_LINE_CODING));
                break;

    case USB_DEVICE_CDC_EVENT_GET_LINE_CODING:
                // In this case, the application should send the line coding
                // data to the host. The application must send the
                // USB_DEVICE_ControlSend function to send the data.

                USB_DEVICE_ControlSend(usbDeviceHandle, &lineCoding, sizeof(USB_CDC_LINE_CODING));
                break;

    post edited by _pA89 - 2020/06/29 06:03:30

    Attached Image(s)

    #6
    JEGANATH
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2020/03/27 23:53:38
    • Location: 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/30 20:36:32 (permalink)
    0
    Hi _pA89,
    Thanks for your reply
    Instead of using CDC can i use Vendor class ? 
    #7
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/06/30 20:42:37 (permalink)
    0
    "Vendor class" means that YOU have to write all the code for BOTH ends of the connection.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    al_bin
    Super Member
    • Total Posts : 214
    • Reward points : 0
    • Joined: 2011/02/11 06:28:47
    • Location: 0
    • Status: online
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/01 00:03:59 (permalink)
    0
    MSD class use is prohibited?
    #9
    _pA89
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2017/06/06 12:39:37
    • Location: India
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/01 20:41:21 (permalink)
    0
    You can use Vendor Class but you have to understand and Study USB More(as USB-CDC is preset configuration set by Manufacturers themselves-Less Code).... One Solution could be Stream Data(You Have 128KB SRAM) From USB-UART CDC_COM_PORT_SINGLE and Flash the IC.
    #10
    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/02 02:27:44 (permalink)
    4 (1)
    Hi,
    CDC class is probably not the right class for data transfer.
    I suggest you use MSD class (easier than vendor class...)
    Harmony v2.06 includes several out of the box projects for USD device MSD class in this directory :
    c:\microchip\harmony\v2_06\apps\usb\device\
    e.g. c:\microchip\harmony\v2_06\apps\usb\device\msd_fs_spiflash\   (your device will appear as a "drive" to the USB HOST but this uses a filesystem). This project show how to use SPI flash memory to store files.
    Regards
     

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #11
    JEGANATH
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2020/03/27 23:53:38
    • Location: 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/06 00:44:15 (permalink)
    0
    Hi,
    I'm having USB pin outs in my PIC32 custom board
    after learning about CDC came to know CDC class use serial converter between Host and device
    I don't want any serial converter in between Host and device
     
    Does CDC class require UART between Host and Device ?
    #12
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/06 02:06:16 (permalink)
    5 (1)
    JEGANATH
    Does CDC class require UART between Host and Device ?

    No. Where did you get that idea?
    CDC is often used to make a serial adaptor.
    You don't need anything extra if you're just using it to communicate with your device connected to the host via USB.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #13
    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: Harmony V2 , PIC32MX / external flash IC programming through USB from PC 2020/07/06 05:29:14 (permalink)
    4 (1)
    Hi,
    CDC class is the class used e.g. to emulate serial ports (UART), this is why it is called VCP Virtual COM Port.
    When you use this class, you definitely have a USB cable between HOST and device...but from software side inside the HOST it looks like having a serial port attached.
    Regards
    NB : AFAIK you can reach around 480kbits/s in FS mode when using CDC class. Not sure if HS mode would help reaching a potentially higher transfer speed...
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #14
    Jump to:
    © 2020 APG vNext Commercial Version 4.5