Simplified Microchip PIC USB demos (C18/XC8 MLA)

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

Postby Dennis » Wed Jul 19, 2017 12:29 pm

Hello,

I am trying to use the 4550 C18 example and modify it for use with 18f2455. Sadly the example doesn't build with MPLAB X 3.61 and C18 v3.47.
I get this error:
C:\Program Files\Microchip\mplabc18\v3.47\h\string.h:623:Error [1174] local 'c' in program memory can not be 'auto'
nbproject/Makefile-PDFSUSB_4550_C18.mk:162: recipe for target 'build/PDFSUSB_4550_C18/production/usb_descriptors.o' failed
make[2]: Leaving directory 'C:/Users/Administrator/Desktop/src/LPC_FSUSB-CDC-X'
nbproject/Makefile-PDFSUSB_4550_C18.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/Administrator/Desktop/src/LPC_FSUSB-CDC-X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 91ms)


I already tried to google it but didn't find anything helpfull and nobody in this thread seemed to have this problem.
Help would be appreciated :)
Dennis
 
Posts: 2
Joined: Wed Jul 19, 2017 12:16 pm
PIC experience: EE Student

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

Postby vloki » Wed Jul 19, 2017 1:20 pm

Read the info in C18_changes_in_framework.txt please.
(Comment line 623 and report here if this file is not included in the download)
vloki
Verified identity
 
Posts: 166
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 Dennis » Wed Jul 19, 2017 1:31 pm

Okay thank you. Didn't realize it meant to just comment the line


Edit: I modified the 4550 code for my 2455 and it built and programmed fine. But the PC just recognizes an unknown USB device. I tried to use the drivers from the MLA but then it just says the drivers for unknown USB device are up to date.

Any suggestions?
Dennis
 
Posts: 2
Joined: Wed Jul 19, 2017 12:16 pm
PIC experience: EE Student

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

Postby vloki » Thu Jul 20, 2017 8:10 am

Did you prove that the oscillator setting and the "fixed memory" stuff is correct?
vloki
Verified identity
 
Posts: 166
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 Charon » Thu Mar 29, 2018 10:18 pm

Hi vloki,
can you help me with location of source code? I installed MLA library on directory:
C:\microchip\mla\v2014_07_22\apps\LPC_FSUSB-CDC-X-r2\...
and build project in MPLAB X IDE v4.15, XC8 (v1.45) for PIC18F4550.

I test it with MLA v2013_12_20 and v2017_03_06 too. Without success.

my configuration:
Output showe me few errors:
Attachments
config1.JPG
config1.JPG (164.8 KiB) Viewed 303 times
Error1.JPG
Error Print Screen
Error1.JPG (234.85 KiB) Viewed 303 times
Charon
 
Posts: 1
Joined: Thu Mar 29, 2018 9:34 pm

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

Postby vloki » Fri Mar 30, 2018 9:45 am

Guess the main problem is that MCHP dropped PLIB for XC8 later than v1.34.
You can install v1.34 and try again, copy the source of the PLIB functions to your project
or rewrite all the functions coming from PLIB.
You can download PLIB from the same site you got xc8 from.
It wont work with the new xc8 version, but you get the source code for the fucktions.

Only two functions should be affected. I modified them recently for the 27J53.
THERE thy look like this now:
Code: Select all
void initADC(void)
{
//    OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_2_TAD,
//            ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS,
//            ADC_TRIG_CCP2,
//            ADC_5ANA & ADC_VBG_OFF);

    ADCON1bits.ADCS = 0b110;    //ADC_FOSC_64
    ADCON1bits.ADFM = 1;        //ADC_RIGHT_JUST
    ADCON1bits.ACQT = 0b01;     //ADC_2_TAD

    ADCON0bits.CHS = ADCH_0;
    ADCON0bits.VCFG = 0b00;     //ADC_REF_VDD_VSS

    ADCTRIGbits.TRIGSEL = 0b00; //ADC_TRIG_CCP2

    ANCON0 = 0xE0;              //ADC_5ANA
    ANCON1bits.VBGEN = 0;       //ADC_VBG_OFF

    ADCON0bits.ADON = 1;
}


/******************************************************************************
 * Function:        void initSpecialEventTrigger(void)
 *
 * PreCondition:    None
 * Input:           None
 * Output:          None
 * Side Effects:    None
 *
 * Overview:
 *
 * Note:
 *
 *****************************************************************************/
void initSpecialEventTrigger(void)
{
    // Timer1 input = 48MHz/4 = 12MHz; Prescaler 8 -> 1.5MHz
//    OpenTimer1(TIMER_INT_OFF & T1_16BIT_RW & T1_SOURCE_FOSC_4 &
//               T1_PS_1_8 & T1_OSC1EN_OFF & T1_SYNC_EXT_OFF,
//                TIMER_GATE_OFF);
 
    T1CONbits.RD16 = 1;         //T1_16BIT_RW
    T1CONbits.TMR1CS = 0b00;    //T1_SOURCE_FOSC_4
    T1CONbits.T1CKPS = 0b11;    //T1_PS_1_8
    T1CONbits.T1OSCEN = 0;      //T1_OSC1EN_OFF
    T1CONbits.nT1SYNC = 0;      //T1_SYNC_EXT_OFF
    T1GCONbits.TMR1GE = 0;      //TIMER_GATE_OFF


    T1CONbits.TMR1ON = 0;       // gets activated later when measurement starts
    CCPTMRS0bits.C2TSEL = 0;    // timer <-> ccp module (CCP2 / TMR1)
    CCPR2 = 15000;              // 1.5MHz/100Hz
    ECCP2CONbits.CCP2M = 0b1011; // Compare Mode with Special Event Trigger
}

For the 4550 they are different, but I think you can do this with the help of the data sheet ;-)
vloki
Verified identity
 
Posts: 166
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Previous

Return to USB

Who is online

Users browsing this forum: No registered users and 1 guest