Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 12:30:58 12:30


Login with username, password and session length


Pages: [1]
Print
Author Topic: USB problem with proton 3.5.5.5  (Read 13234 times)
0 Members and 1 Guest are viewing this topic.
IZ2NZR
Active Member
***
Offline Offline

Posts: 141

Thank You
-Given: 125
-Receive: 654


« on: October 04, 2013, 06:57:41 18:57 »

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.
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

    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 :
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

Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #1 on: October 04, 2013, 08:26:25 20:26 »

Suggest you repost to http://www.protonbasic.co.uk/forum.php. Les has mellowed.
Logged

Win 7 Ult x64 SP1 on HP2570p
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #2 on: October 24, 2013, 04:08:46 16:08 »

Quote
Declare USB_Descriptor = "CDCdesc.Inc"   in : Include "CDC_Descriptor.Inc"
Here is your problem I suppose. You need to have the USB_Descriptor declared
Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #3 on: October 25, 2013, 02:45:32 14:45 »

I think thats just to allow for changes in Proton syntax. Certainly the include form is correct for latest version. The Proton board really has mellowed, no more demands for serial numbers, what have you got to lose?

George
Logged

Win 7 Ult x64 SP1 on HP2570p
IZ2NZR
Active Member
***
Offline Offline

Posts: 141

Thank You
-Given: 125
-Receive: 654


« Reply #4 on: October 26, 2013, 06:21:29 18:21 »

ok,
I will try
Logged
towlerg
Senior Member
****
Offline Offline

Posts: 263

Thank You
-Given: 474
-Receive: 104

What is this for?


« Reply #5 on: December 18, 2013, 04:46:49 16:46 »

I guess you didn't feel comfortable using the Proton forum, so I had a quick look. My quess is that this is a sample that came with the earlier version and the way status is detected has changed. Why not use the sample that came with 3.5.5.5?

George
Logged

Win 7 Ult x64 SP1 on HP2570p
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC