Simplified Microchip PIC USB demos (C18/XC8 MLA)

Simplified Microchip PIC USB demos (C18/XC8 MLA)

Postby vloki » Tue Jul 22, 2014 4:29 pm

Some projects I created because the original MCHP demo projects in the MLA are unusable for beginners.
This thread is a continuation of Simplified Microchip USB demo projects (HID / CDC; PIC18) in microchip forum.

The packed MPLAB-X projects contain configurations for PIC18 and there are only two files
that depend on the hardware. A header file and a source file in which their names contain PIC and DemoBoard.

Simplified Custom HID Demo project using MLA v2013_12_ 20 / v2014_07_22
Simplified Custom CDC Demo project using MLA v2013_12_ 20 / v2014_07_22
Last edited by vloki on Tue Jan 13, 2015 3:24 pm, edited 6 times in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos ( C18/XC8, MLA v13_12

Postby vloki » Tue Jul 22, 2014 4:29 pm

Simplified Custom HID Demo project using MLA v2013_12_ 20 / v2014_07_22

The project contains configurations for PIC18F14K50, PIC18F4550 and PIC18F27J53 and PIC18F25K50
and should compile with C18 and XC8 compiler.


The user part of the firmware is located in the file app_custom_hid.

USB data transfer is handled by APP_CustomHIDTasks() which calls the functions usbIN() and usbOUT().
Data is contained in the ToSendDataBuffer[64] and ReceivedDataBuffer[64].
xBuffer[O] is used for an additional size information of transfered data.

The demo can handle some LEDs and read a poti, a button or internal memory of the PIC.
These actions are controlled in function cmd() which is called during a usb-OUT transaction.

The board/processor specific code is now located in a pair of source/header files located in
a separate folder named "BSP-FILES". (These files are not USB device class specific)

<edit> added PIC18F25K50 and switched to MLA v2014_07_22 -> r2
<edit2> newer versions with newer MLA and more configurations (pic16F145x) are here
Attachments
LPC_FSUSB-HID-X-r2.zip
MLA v2014_07_22 +PIC18F25K50 -> r2
(+changes in command IDs)
(117.16 KiB) Downloaded 4416 times
LPC_FSUSB-HID-X-r1.zip
(114.86 KiB) Downloaded 2479 times
Last edited by vloki on Tue Oct 27, 2015 3:39 pm, edited 9 times in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos ( C18/XC8, MLA )

Postby vloki » Tue Jul 22, 2014 4:42 pm

Simplified Custom CDC Demo project using MLA v2013_12_ 20 / v2014_07_22

The project contains configurations for PIC18F14K50, PIC18F4550 and PIC18F27J53 and PIC18F25K50 (in r2)
and should compile with C18 and XC8 compiler.
To make it compatible with C18 I had to make some small modifications in the framework
(See C18_changes_in_framework.txt)



The user part of the firmware is located in the file app_custom_cdc.

USB data transfer is handled by APP_CustomCDCTasks()
Data is contained in the usbOutBuffer[64] and usbInBuffer[64];
xBuffer[0] is used for an additional size information of transfered data.

The demo can handle some LEDs and read a poti, a button or internal memory of the PIC.
These actions are controlled in function APP_cmd() which is called during a usb-OUT transaction.

The xx5x_hid.h and xx5x_hid.c files hold the board/processor specific code.


<edit>some modifications with the fixed addresses (while figthing with that d*mn 27j53) -> -r1
<edit2> The framework header "usb_device_local.h" is missing in the package. You can copy it from original MLA

<edit3>switch to MLA v2014_07_22, adding configuration for PIC18F25K50 and move files to the BSP folder -> -r2
<edit4> newer versions with newer MLA and more configurations (pic16F145x) are here
Attachments
LPC_FSUSB-CDC-X-r2.zip
r2 -> MLA v2014_07_22 +PIC18F25K50
(137.3 KiB) Downloaded 2750 times
LPC_FSUSB-CDC-X-r1.zip
r1 -> modification in fixed addresses definition
(122.72 KiB) Downloaded 1700 times
Last edited by vloki on Tue Oct 27, 2015 3:39 pm, edited 7 times in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby vloki » Thu Jul 24, 2014 10:14 am

Placeholder for new version of cross platform HID terminal
found in previous thread on MCHP forum

<edit2> newer version of this software (inclusive windows exe) is here
<edit> If you use firmware r2 from above, please change the command IDs:
Code: Select all
typedef enum {
    CID_INIT        = 0x00,
    CID_STOP        = 0x01,     // stop sending data
//    CID_CLOSE,
//    CID_OPEN,
//    CID_START       = 0x04,     // send data (continuous)
//    CID_SNGLSHOT    = 0x05,     // send one frame

//    CID_CHANNELS    = 0x06,     //
//    CID_SMPLINTRVL  = 0x07,     // set sampling time (in us)
//    CID_PCKSIZE     = 0x08,     // set package size (continuous)
//    CID_FRAMESIZE   = 0x09,     // set packagesize (single shot)
//    CID_RESOLUTION  = 0x0A,     // set 8bit / 16bit data

    CID_MISC        = 0x0B,     // send miscellanous info-string
    CID_MANU        = 0x0C,     // send developper info-string
    CID_DATE        = 0x0D,     // send date info-string
    CID_VERSION     = 0x0E,     // send version info-string
    CID_DEVICE      = 0x0F,     // send device identification string

//    CID_LED1_OFF    = 0x10,     // LED_1 switch off
//    CID_LED1_ON     = 0x11,     // LED_1 switch on
//    CID_LED1_TOG    = 0x13,     // LED_1 toggle
//    CID_LED1_GET    = 0x15,     // LED_1 get status
//    CID_LED2_OFF    = 0x20,
//    CID_LED2_ON     = 0x21,
//    CID_LED2_TOG    = 0x23,
//    CID_LED2_GET    = 0x25,
    CID_LED3_OFF    = 0x30,
    CID_LED3_ON     = 0x31,
    CID_LED3_TOG    = 0x33,
//    CID_LED3_GET    = 0x35,
    CID_LED4_OFF    = 0x40,
    CID_LED4_ON     = 0x41,
//    CID_LED4_TOG    = 0x43,
//    CID_LED4_GET    = 0x45,

    CID_BUTTON      = 0x50,    // get button state (1 == pressed)
    CID_POTI        = 0x60,    // get analog value
    ID_MESSAGE      = 0x80,
    ID_ERROR        = 0xFF
}COMMANDS;
Attachments
Qt5-HID_20141103.zip
(86.25 KiB) Downloaded 1677 times
HID-Demo-D.png
HID-Demo-D.png (49.02 KiB) Viewed 38585 times
HID-Demo-T.png
HID-Demo-T.png (53.68 KiB) Viewed 38585 times
Last edited by vloki on Tue Oct 27, 2015 3:45 pm, edited 6 times in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby vloki » Thu Jul 24, 2014 10:14 am

Placeholder for new version of cross platform (CDC) terminal
found in previous thread on MCHP forum

<edit> newer version of this software (inclusive windows exe) is here


Description follows ...
Attachments
Qt5-SerialComm-r1.zip
(83.74 KiB) Downloaded 1208 times
SerialTerminal.png
SerialTerminal.png (30.02 KiB) Viewed 40186 times
Last edited by vloki on Tue Oct 27, 2015 3:46 pm, edited 1 time in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby giorgik » Thu Sep 11, 2014 7:14 pm

Hi vloki, interesting your post. I use MLA current: mla_v2014_07_22_windows_installer.exe.
In your post you put only the figure of the HID terminal and you did not put the project or the executable. Would you be so kind as to add, sare very interested in this project, I would be very helpful for my first project based on PIC16F1455 USB HID.Can I possibly ask you to design aids in that I'm doing ?
giorgik
 
Posts: 1
Joined: Thu Sep 11, 2014 7:04 pm

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby vloki » Fri Sep 12, 2014 9:53 am

The *newer* version is still in work ;-)
Please click the link in first post to the microchip forum

It's done now ...
Last edited by vloki on Fri Nov 14, 2014 8:15 am, edited 1 time in total.
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby Interrupt » Thu Oct 16, 2014 10:24 am

I'm unable to get the project to compile I suspect it's got something to do with my complier settings the compiler is looking in MLA v2014_07_22 instead of MLA v2013_12_20 please see attached .jegs.

Sorry my knowledge of search paths are limited at best, any help would be greatly appreciated :oops:
Attachments
USB3.jpg
USB3.jpg (176.74 KiB) Viewed 39083 times
USB2.jpg
USB2.jpg (115.33 KiB) Viewed 39083 times
USB1.jpg
USB1.jpg (136.48 KiB) Viewed 39083 times
Interrupt
 
Posts: 4
Joined: Thu Oct 16, 2014 8:36 am
PIC experience: Experienced Hobbyist

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby vloki » Thu Oct 16, 2014 10:44 am

You possibly have to adjust the include directory path ...
screenshot2.png
screenshot2.png (54.6 KiB) Viewed 39080 times
vloki
Verified identity
 
Posts: 176
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA v2013_12

Postby Interrupt » Thu Oct 16, 2014 9:39 pm

I try your suggestion, unfortunately no success! :cry:

if anyone has any ideas please!
Attachments
USB5.jpg
USB5.jpg (133 KiB) Viewed 39063 times
USB4.jpg
USB4.jpg (145.26 KiB) Viewed 39063 times
Interrupt
 
Posts: 4
Joined: Thu Oct 16, 2014 8:36 am
PIC experience: Experienced Hobbyist

Next

Return to USB

Who is online

Users browsing this forum: No registered users and 2 guests

cron