I tried to use proton 3.5.5.5 with CDC USB.
I had no problem with version 3.5.2.7 but If I upgrade the code to 3.5.5.5 it don't run.
this is a very simple code in the old version, when the pic receive some data from com port, it respond with the same data.
Device = 18F2550
Config_Start
PLLDIV = 1 ;No prescale (4 MHz oscillator input drives PLL directly)
CPUDIV = OSC1_PLL2 ;[Primary Oscillator Src: /1][96 MHz PLL Src: /2]
USBDIV = 2 ;USB clock source comes from the 96 MHz PLL divided by 2
FOSC = HSPLL_HS ;HS oscillator, PLL enabled (HSPLL)
FCMEN = OFF ;Fail-Safe Clock Monitor disabled
IESO = On ;Oscillator Switchover mode enabled
PWRT = On ;PWRT enabled
BOR = On ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
BORV = 3 ;Minimum setting
VREGEN = On ;USB voltage regulator enabled
WDT = OFF ;WDT disabled (control is placed on the SWDTEN bit)
WDTPS = 128 ;1:128
CCP2MX = On ;CCP2 input/output is multiplexed with RC1
PBADEN = OFF ;PORTB<4:0> pins are configured as digital I/O on Reset
LPT1OSC = On ;Timer1 configured for low-power operation
MCLRE = OFF ;RE3 input pin enabled; MCLR pin disabled
STVREN = On ;Stack full/underflow will cause Reset
LVP = OFF ;Single-Supply ICSP disabled
XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF ;Block 0 (000800-001FFFh) is not code-protected
CP1 = OFF ;Block 1 (002000-003FFFh) is not code-protected
CP2 = OFF ;Block 2 (004000-005FFFh) is not code-protected
CP3 = OFF ;Block 3 (006000-007FFFh) is not code-protected
CPB = OFF ;Boot block (000000-0007FFh) is not code-protected
CPD = OFF ;Data EEPROM is not code-protected
WRT0 = OFF ;Block 0 (000800-001FFFh) is not write-protected
WRT1 = OFF ;Block 1 (002000-003FFFh) is not write-protected
WRT2 = OFF ;Block 2 (004000-005FFFh) is not write-protected
WRT3 = OFF ;Block 3 (006000-007FFFh) is not write-protected
WRTC = OFF ;Configuration registers (300000-3000FFh) are not write-protected
WRTB = OFF ;Boot block (000000-0007FFh) is not write-protected
WRTD = OFF ;Data EEPROM is not write-protected
EBTR0 = OFF ;Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks
EBTR1 = OFF ;Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks
EBTR2 = OFF ;Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks
EBTR3 = OFF ;Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks
EBTRB = OFF ;Boot block (000000-0007FFh) is not protected from table reads executed in other blocks
Config_End
;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
Declare Xtal = 48 ' Set the oscillator speed to 48MHz
Declare USB_Descriptor = "CDCdesc.Inc"
Dim Array1[20] As Byte ' Used to hold some output characters
Dim Out_Buffer As String * 20 ' Used to hold some output characters
Dim In_Buffer As String * 20 ' Used to hold some input characters
Symbol Carry_Flag = STATUS.0 ' High if microcontroller does not have control over the DP buffer
Symbol TRNIF = UIR.3 ' Low if USB Busy
All_Digital = True ' Set PORTA and PORTD to digital mode
'------------------------------------------------------------------------
DelayMS 100
High PORTC.6
' Wait for things to stabilise
'-------------------------------------------------------------------------------------------
Clear ' Clear all RAM before we start
'-----------------attiva USB ----------------------------------------------------------------------
Dim PP0 As Byte System ' USBPOLL status return
Repeat ' \
USBPoll ' Wait for the USB interface to become attached
Until PP0 = %00000110 ' /
'-----------------------------------------------------------------------------------------------
StrN Array1 = " Array Buffer\n\r" ' Fill the array with Null terminated characters
Out_Buffer = " String Buffer\n\r" ' Fill the string with Null terminated characters
start:
Repeat ' Wait for USB input
USBIn 3, In_Buffer, Auto ' Poll the USB and Receive some data from endpoint 3
Until Carry_Flag = 0 ' Keep looking until data is able to be received
Toggle PORTC.6 ' led binking
__USBOut_Buffer = In_Buffer
'
' Transmit from the USB's internal TX buffer String. Null terminated.
'
Repeat
USBOut 3, __USBOut_Buffer, Auto ' Poll the USB and Transmit the buffer from endpoint 3
Until Carry_Flag = 0 ' Keep trying if the microcontroller does not have control over the buffer
Repeat : Until TRNIF = 1 ' Wait for completion before transmitting anything else
Clear In_Buffer
GoTo start
the same code compiled with vesrion 3.5.5.5 dont run.
I changed only the row :Declare USB_Descriptor = "CDCdesc.Inc" in : Include "CDC_Descriptor.Inc"
here the code :
Device = 18F2550
Config_Start
PLLDIV = 1 ;No prescale (4 MHz oscillator input drives PLL directly)
CPUDIV = OSC1_PLL2 ;[Primary Oscillator Src: /1][96 MHz PLL Src: /2]
USBDIV = 2 ;USB clock source comes from the 96 MHz PLL divided by 2
FOSC = HSPLL_HS ;HS oscillator, PLL enabled (HSPLL)
FCMEN = OFF ;Fail-Safe Clock Monitor disabled
IESO = On ;Oscillator Switchover mode enabled
PWRT = On ;PWRT enabled
BOR = On ;Brown-out Reset enabled in hardware only (SBOREN is disabled)
BORV = 3 ;Minimum setting
VREGEN = On ;USB voltage regulator enabled
WDT = OFF ;WDT disabled (control is placed on the SWDTEN bit)
WDTPS = 128 ;1:128
CCP2MX = On ;CCP2 input/output is multiplexed with RC1
PBADEN = OFF ;PORTB<4:0> pins are configured as digital I/O on Reset
LPT1OSC = On ;Timer1 configured for low-power operation
MCLRE = OFF ;RE3 input pin enabled; MCLR pin disabled
STVREN = On ;Stack full/underflow will cause Reset
LVP = OFF ;Single-Supply ICSP disabled
XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF ;Block 0 (000800-001FFFh) is not code-protected
CP1 = OFF ;Block 1 (002000-003FFFh) is not code-protected
CP2 = OFF ;Block 2 (004000-005FFFh) is not code-protected
CP3 = OFF ;Block 3 (006000-007FFFh) is not code-protected
CPB = OFF ;Boot block (000000-0007FFh) is not code-protected
CPD = OFF ;Data EEPROM is not code-protected
WRT0 = OFF ;Block 0 (000800-001FFFh) is not write-protected
WRT1 = OFF ;Block 1 (002000-003FFFh) is not write-protected
WRT2 = OFF ;Block 2 (004000-005FFFh) is not write-protected
WRT3 = OFF ;Block 3 (006000-007FFFh) is not write-protected
WRTC = OFF ;Configuration registers (300000-3000FFh) are not write-protected
WRTB = OFF ;Boot block (000000-0007FFh) is not write-protected
WRTD = OFF ;Data EEPROM is not write-protected
EBTR0 = OFF ;Block 0 (000800-001FFFh) is not protected from table reads executed in other blocks
EBTR1 = OFF ;Block 1 (002000-003FFFh) is not protected from table reads executed in other blocks
EBTR2 = OFF ;Block 2 (004000-005FFFh) is not protected from table reads executed in other blocks
EBTR3 = OFF ;Block 3 (006000-007FFFh) is not protected from table reads executed in other blocks
EBTRB = OFF ;Boot block (000000-0007FFh) is not protected from table reads executed in other blocks
Config_End
;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
Declare Xtal = 48 ' Set the oscillator speed to 48MHz
Include "CDC_Descriptor.Inc"
Dim Array1[20] As Byte ' Used to hold some output characters
Dim Out_Buffer As String * 20 ' Used to hold some output characters
Dim In_Buffer As String * 20 ' Used to hold some input characters
Symbol Carry_Flag = STATUS.0 ' High if microcontroller does not have control over the DP buffer
Symbol TRNIF = UIR.3 ' Low if USB Busy
All_Digital = True ' Set PORTA and PORTD to digital mode
'------------------------------------------------------------------------
DelayMS 100
High PORTC.6
' Wait for things to stabilise
'-------------------------------------------------------------------------------------------
Clear ' Clear all RAM before we start
'-----------------attiva USB ----------------------------------------------------------------------
Dim PP0 As Byte System ' USBPOLL status return
Repeat ' \
USBPoll ' Wait for the USB interface to become attached
Until PP0 = %00000110 ' /
'-----------------------------------------------------------------------------------------------
StrN Array1 = " Array Buffer\n\r" ' Fill the array with Null terminated characters
Out_Buffer = " String Buffer\n\r" ' Fill the string with Null terminated characters
start:
Repeat ' Wait for USB input
USBIn 3, In_Buffer, Auto ' Poll the USB and Receive some data from endpoint 3
Until Carry_Flag = 0 ' Keep looking until data is able to be received
Toggle PORTC.6 ' led binking
__USBOut_Buffer = In_Buffer
'
' Transmit from the USB's internal TX buffer String. Null terminated.
'
Repeat
USBOut 3, __USBOut_Buffer, Auto ' Poll the USB and Transmit the buffer from endpoint 3
Until Carry_Flag = 0 ' Keep trying if the microcontroller does not have control over the buffer
Repeat : Until TRNIF = 1 ' Wait for completion before transmitting anything else
Clear In_Buffer
GoTo start
Windowd see the virtual com port.
also the serilal com plugin connect to the pic.
If I try to send somthing, it dont receive and the comunication program freeze.
It seems that the program don't pass the USBpoll command.
Were i am wong ? what is my mistake ?
please help me with some suggestion