Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

BASCOM-AVR - USB Add On

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Wed Oct 16, 2019 12:06 pm    Post subject: BASCOM-AVR - USB Add On Reply with quote

Hi,

would like to ask if anyone of you has already gained experience with the BASCOM-AVR - USB Add On?

I have create a small circuit on which I have 16 LEDs.

The sample code from MCS Electronic sends and receives 8 bytes.
See code in the example below.

Is it possible to extend this by 16 bytes?
If so, could someone show this to me?

Code:

Const Endpoint_nb_1 = Ep_hid_in Or &H80
Const Ep_attributes_1 = 3                                   ' BULK = 0x02, INTERUPT = 0x03
Const Ep_in_length_1 = 8
Const Ep_size_1 = Ep_in_length_1
Const Ep_interval_1 = 20                                    ' Interrupt polling interval from host

Const Endpoint_nb_2 = Ep_hid_out
Const Ep_attributes_2 = 3                                   ' BULK = 0x02, INTERUPT = 0x03
Const Ep_out_length = 8
Const Ep_size_2 = Ep_out_length
Const Ep_interval_2 = 20                                    ' interrupt polling from host


Sub Hid_task()

    If Usb_connected = 1 Then                               ' Check USB HID is enumerated

       Usb_select_endpoint Ep_hid_out                       ' Get Data Repport From Host
       If Ueintx.rxouti = 1 Then                            ' Is_usb_receive_out())

          'Die ankommende Daten werden zunächst in eine Temp. Variable übergeben. Wert1, Wert2, Wert3, Wert4
          Wert1 = Uedatx                                    
          Wert2 = Uedatx                                    
          Wert3 = Uedatx                                    
          Wert4 = Uedatx                                    
          Wert5 = Uedatx                                    
          Wert6 = Uedatx                                    
          Wert7 = Uedatx                                    
          Wert8 = Uedatx                                    
         
          Usb_ack_receive_out

       End If
           
            Usb_select_endpoint Ep_hid_in                         ' Ready to send these information to the host application

      If Ueintx.txini = 1 Then                              ' Is_usb_in_ready())
         Uedatx = Wert11
         Uedatx = Wert22
         Uedatx = Wert33
         Uedatx = Wert44
         Uedatx = Wert55
         Uedatx = Wert66
         Uedatx = Wert77
         Uedatx = Wert88
     

         Usb_ack_fifocon                                    ' Send data over the USB

      End If
   End If
  Reset Watchdog
End Sub

'init the user endpoints
Sub Usb_user_endpoint_init(byval Nm As Byte)
  Call Usb_configure_endpoint(ep_hid_in , Type_interrupt , Direction_in , Size_8 , One_bank , Nyet_enabled)
  Call Usb_configure_endpoint(ep_hid_out , Type_interrupt , Direction_out , Size_8 , One_bank , Nyet_enabled)
End Sub


Usb_hid_report:
Data &H06 , &HFF , &HFF                                     ' 04|2   , Usage Page (vendordefined?)
Data &H09 , &H01                                            ' 08|1   , Usage      (vendordefined
Data &HA1 , &H01                                            ' A0|1   , Collection (Application)
'      // IN report
Data &H09 , &H02                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H03                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , Logical Minimum(0 for signed byte?)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte?)
Data &H75 , &H08                                            ' 74|1   , Report Size(Cool = field size in bits = 1 byte
Data &H95 , Length_of_report_in                             ' 94|1:ReportCount(size) = repeat count of previous item
Data &H81 , &H02                                            ' 80|1: IN report (Data,Variable, Absolute)
'      // OUT report
Data &H09 , &H04                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H05                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , Logical Minimum(0 for signed byte?)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte?)
Data &H75 , &H08                                            ' 74|1   , Report Size(Cool = field size in bits = 1 byte
Data &H95 , Length_of_report_out                            ' 94|1:ReportCount(size) = repeat count of previous item
Data &H91 , &H02                                            ' 90|1: OUT report (Data,Variable, Absolute)
'      // Feature report
Data &H09 , &H06                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H07                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , LogicalMinimum(0 for signed byte)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte)
Data &H75 , &H08                                            ' 74|1   , Report Size(Cool =field size in bits = 1 byte
Data &H95 , &H04                                            ' 94|1:ReportCount
Data &HB1 , &H02                                            ' B0|1:   Feature report
Data &HC0
                                                 ' C0|0    , End Collection

 



Is it possible, if I write here
Code:

Data &H75 , &H10
 

instead of
Code:

Data &H75 , &H08 ??
 



and here
Code:

Call Usb_configure_endpoint(ep_hid_in , Type_interrupt , Direction_in , Size_16 , One_bank , Nyet_enabled)
 

instead of
Code:

Call Usb_configure_endpoint(ep_hid_in , Type_interrupt , Direction_in , Size_8 , One_bank , Nyet_enabled)
 


I have check it in the File USB.inc, there is only Size_8, Size_32 and Size_64 but the Size_16 is not available.

Who can help me in this issue?

thanks in advanced
Sinan

(BASCOM-AVR version : 2.0.8.1 , Latest : 2.0.8.2 )
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 539

germany.gif
PostPosted: Wed Oct 16, 2019 12:33 pm    Post subject: Reply with quote

Hi Kati,
you can have a look at here:
https://bascomforum.de/lexicon/index.php?entry/72-laz-10-hid-usb-device-at90usb162/

It's a full Sample an receives and transmites more than one Byte.

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Wed Oct 16, 2019 1:07 pm    Post subject: Reply with quote

Hi Michael,

but you sent also only 8 Byte in one Package.

I belive you have not understand what I mean Smile

I want sent 16 byte in one package.
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 539

germany.gif
PostPosted: Wed Oct 16, 2019 1:19 pm    Post subject: Reply with quote

to control 16 LEDs you will only need 2 Bytes Very Happy

but you can also have a look at:

Const Length_of_report_out = 8
Dim Hid_in(length_of_report_out) As Byte

maybe theres the solution for you to receive more than 8 Bytes in one Package?

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Wed Oct 16, 2019 5:11 pm    Post subject: Reply with quote

Hi Micha,

mir geht es nicht darum, wieviele LEDs ich auf dem Board habe.
Vielmehr möchte ich es verstehen, warum in der USB.inc Size_8, Size_32_ Size 64 steht.

Bedeutet das, das ich das auch in der Hauptprogramm so verändern kann und statt Size_8 auch Size_32 senden kann?

VG
Sinan



Hi Micha,

I do not care how many LEDs I have on the board.
Rather, I want to understand why USB.inc is Size_8, Size_32_ Size 64.

Does that mean I can change that in the main program and send Size_32 instead of Size_8?
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 539

germany.gif
PostPosted: Thu Oct 17, 2019 6:37 am    Post subject: Reply with quote

size_8 = send Byte
size_16 = send Word
size_32 = send DWord

Report Size: 8-bit field size. This means we send bytes

see: https://www.silabs.com/documents/public/application-notes/AN249.pdf

4.4.1.4. Data Types
Report descriptors also contain extensive information describing the characteristics of each data item. Logical
Minimum and Logical Maximum items describe the boundary conditions the data contained in reports can reach.
The Report Size item describes how many bits each data item uses, and Report Count describes how many data
items are contained inside the report. A report of Size 8 and Count 2 would contain 16 bits, or 2 bytes of data.

_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Fri Oct 18, 2019 7:05 pm    Post subject: Reply with quote

Hello,

in another Thread

https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=10660&highlight=usb+add

there write Mark these:

Code:

Const Length_of_report_out = 64 ' was 8
Const Ep_out_length = 64 ' was 8

Call Usb_configure_endpoint(ep_hid_out , Type_interrupt , Direction_out , Size_64 , One_bank , Nyet_enabled)

Is it possible also set to 16?

Because the Size_16 in not in USB.inc included.
Only Size_8, Size_32 and Size_64

Can I add in USB.inc Size_16 and this is then enough?
Like so:
Const Size_8 = 0
Const Size_16 = 1
Const Size_32 = 2
Const Size_64 = 3

BR
Sinan
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4824
Location: Holland

blank.gif
PostPosted: Sat Oct 19, 2019 2:34 pm    Post subject: Reply with quote

you can use this table :

Code:
Const Size_8 = 0
Const Size_16=1
Const Size_32 = 2
Const Size_64 = 3
Const Size_128=4
Const Size_256=5
Const Size_512=6


but... you can only use it when the processor supports it. Consult the datasheet.

for an LCD i used this :   Call Usb_configure_endpoint(ep_hid_out , Type_interrupt , Direction_out , Size_64 , One_bank , Nyet_enabled)
i did not check your chip but it is likely it supports 16 bytes as end point size.

Also change the endpoint details like :

Const Endpoint_nb_2 = Ep_hid_out
Const Ep_attributes_2 = 3                                   ' BULK = 0x02, INTERUPT = 0x03
Const Ep_out_length = 64
Const Ep_size_2 = Ep_out_length
Const Ep_interval_2 = 1                                     ' interrupt polling from host

Const Length_of_report_out = 64

and in the report too :
'   OUT report
Data &H09 , &H01                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H05                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , Logical Minimum(0 for signed byte?)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte?)
Data &H75 , &H08                                            ' 74|1   , Report Size(Cool = field size in bits = 1 byte
Data &H95 , Length_of_report_out                            ' 94|1:ReportCount(size) = repeat count of previous item
Data &H91 , &H02                                            ' 90|1: OUT report (Data,Variable, Absolute)
 

in your case it would be 16

_________________
Mark
Back to top
View user's profile Visit poster's website
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Mon Oct 28, 2019 9:44 pm    Post subject: Reply with quote

Hi,

I use the Chip AT90USB162 with 8MHz Quarz.
Currently I have this problem, that communication will Interrupt on PC Software while data Transfer.

I try to find out where the mistake is. Is it on the Hardware or on my PC Software.

BR
Sinan
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4824
Location: Holland

blank.gif
PostPosted: Tue Oct 29, 2019 8:48 am    Post subject: Reply with quote

i do not know which pc soft you use.
but mind this : Const Ep_interval_2 = 1
this gives a 1ms interval. you might need to increase it.

depending on pc cpu , windows version, windows does need time for other tasks too.
also, turn off logging in the bascom code.

_________________
Mark
Back to top
View user's profile Visit poster's website
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Sun Nov 03, 2019 8:26 pm    Post subject: Reply with quote

Hi,

How can I turn off logging in the bascom code?
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4824
Location: Holland

blank.gif
PostPosted: Mon Nov 04, 2019 12:50 pm    Post subject: Reply with quote

Code:
Const Mdbg = 1                                              ' add print to see what is happening


just set it to 0:

Code:
Const Mdbg = 0

_________________
Mark
Back to top
View user's profile Visit poster's website
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Thu Nov 07, 2019 11:32 pm    Post subject: Reply with quote

Hi Mark,
this
Code:
Const Mdbg = 0

is already Zero Smile

Here my whole code.
I have try switch to Size_16

but doesn't works.

you can see what I have edit, is marked as '<---------------------------- Edit from me to...


Code:

$regfile = "usb162.dat"
$crystal = 8000000
'$baud = 19200

$hwstack = 64
$swstack = 86
$framesize = 86

Const Mdbg = 0                                              ' if you want to see all USB communication turn it on but turin it off(0) for your application since it will cost space
Const Chiddevice = 1                                        ' set this on for HID devices


Config Clockdiv = 1                                         ' we let the internal clock divider divide by 1 which will result in 8 Mhz clock
'Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0


Config Submode = New
Const Vendor_id = &H16D0                                    ' MCS Vendor ID
Const Product_id = &H0D0E
'specific device constants
Const Ep_control_length = 16                    '<---------------------------- Edit from me to 16
Const User_conf_size = 41
Const Size_of_report = 53
Const Device_class = 0
Const Device_sub_class = 0
Const Device_protocol = 0
Const Release_number = &H1000
Const Length_of_report_in = 16          '<---------------------------- Edit from me to 16
Const Length_of_report_out = 16         '<---------------------------- Edit from me to 16
Const Interface_nb = 0
Const Alternate = 0
Const Nb_endpoint = 2
Const Interface_class = 3                                   ' HID
Const Interface_sub_class = 0
Const Interface_protocol = 0
Const Interface_index = 0

'Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'Print "USB GENERIC test"

Declare Sub Usb_user_endpoint_init
Declare Sub Hid_test_hit()
Declare Sub Hid_task()
Declare Sub Hid_task_init()
Declare Sub Backlight()

Const Usb_config_attributes_reserved = &H80
Const Usb_config_buspowered = Usb_config_attributes_reserved
Const Usb_config_selfpowered = Usb_config_attributes_reserved Or &H40
Const Usb_remote_wakeup = 0                                 'disable remote wakeup
Const Usb_config_remotewakeup = Usb_config_attributes_reserved Or &H20

Const Nb_interface = 1
Const Conf_nb = 1
Const Conf_index = 0
Const Conf_attributes = Usb_config_buspowered + Usb_config_remotewakeup
Const Max_power = 50                                        ' 100 mA


Const Nb_endpoints = 2                                      ' number of endpoints in the application including control endpoint
Const Ep_hid_in = 1
Const Ep_hid_out = 2

Const Endpoint_nb_1 = Ep_hid_in Or &H80
Const Ep_attributes_1 = 3                                   ' BULK = 0x02, INTERUPT = 0x03
Const Ep_in_length_1 = 16                                               '<---------------------------- Edit from me to 16
Const Ep_size_1 = Ep_in_length_1
Const Ep_interval_1 = 1                                     ' Interrupt polling interval from host

Const Endpoint_nb_2 = Ep_hid_out
Const Ep_attributes_2 = 3                                   ' BULK = 0x02, INTERUPT = 0x03
Const Ep_out_length = 16                                                '<---------------------------- Edit from me to 16
Const Ep_size_2 = Ep_out_length
Const Ep_interval_2 = 1                                     ' interrupt polling from host

                                 '&H0409 for english
Config Usb = Device , Language = &H0407 , Manufact = "TUZCU" , Product = "Laufschrift" , Serial = "20190705"

'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Config für den Schieberegistern
Config Portd.0 = Output
Config Portd.1 = Output
Config Portd.2 = Output
 Dout1 Alias Portd.0                                        
 Sck1 Alias Portd.1                                        
 Rck1 Alias Portd.2
 
 
Dim Usb_kbd_state As Byte , Usb_key As Byte , Usb_data_to_send As Byte

Dim Wert1 As Integer                                        
Dim Wert2 As Byte                                          
Dim Wert3 As Byte                                          
Dim Wert4 As Byte                                          
Dim Wert5 As Byte                                          
Dim Wert6 As Byte                                          
Dim Wert7 As Byte                                          
Dim Wert8 As Byte                                          
Dim Wert9 As Byte                                          
Dim Wert10 As Byte                                          
Dim Wert11 As Byte                                          
Dim Wert12 As Byte                                          
Dim Wert13 As Byte                                          
Dim Wert14 As Byte                                          
Dim Wert15 As Byte
Dim Wert16 As Byte

Dim Ausgang1 As Byte
Dim Ausgang2 As Byte
Dim Ausgang3 As Byte
Dim Ausgang4 As Byte


'Print "task init"
Usb_task_init                                               ' init the usb task
Hid_task_init                                               ' init the USB task
Do


  Usb_task                                                  'call this subroutine once in a while
  Hid_task                                                  'call this subroutine once in a while

  'you can call your sub program here
Loop

'nothing needed to init
Sub Hid_task_init()
  'nothing
End Sub



'HID task must be checked regular
Sub Hid_task()
'Start Watchdog
    If Usb_connected = 1 Then                               ' Check USB HID is enumerated

       Usb_select_endpoint Ep_hid_out                       ' Get Data Repport From Host
       If Ueintx.rxouti = 1 Then                            ' Is_usb_receive_out())

         
          Wert1 = Uedatx                                    'DeviceAddresse
          Wert2 = Uedatx                                    'Daten Art
          Wert3 = Uedatx                                    'Value3 for 1 - 8
          Wert4 = Uedatx                                    'Value4 for 9 - 16
          Wert5 = Uedatx                                    'Value5 for 17 - 24
          Wert6 = Uedatx                                    'Value6 for 25 - 32
          Wert7 = Uedatx                                    'Value7 for 33 - 40
          Wert8 = Uedatx                                    'Value8 for 41 - 48
          Wert9 = Uedatx                                    'Value9 for 49 - 56
          Wert10 = Uedatx                                   'Value10 for 57 - 64
          Wert11 = Uedatx                                  
          Wert12 = Uedatx                                  
          Wert13 = Uedatx                                  
          Wert14 = Uedatx                                   'Timer Interval Änderung erlauben
          Wert15 = Uedatx                                   '
          Wert16 = Uedatx

          Usb_ack_receive_out

       End If
           
              Ausgang1 = Wert3                
          Ausgang2 = Wert4
          Ausgang3 = Wert5
          Ausgang4 = Wert6


                           Shiftout Dout1 , Sck1 , Ausgang4 , 2       ' Daten werden an die jeweilige 74HC595 übergeben

                           Shiftout Dout1 , Sck1 , Ausgang3 , 0       '"

                           Shiftout Dout1 , Sck1 , Ausgang1 , 0       '"

                           Shiftout Dout1 , Sck1 , Ausgang2 , 2       '"
                           Rck1 = 1                        
                           Rck1 = 0                         '"
                           
             
        Waitms 1
       
 Usb_select_endpoint Ep_hid_in                         ' Ready to send these information to the host application

      If Ueintx.txini = 1 Then                              ' Is_usb_in_ready())
         Uedatx = Ausgang1
         Uedatx = Ausgang2
         Uedatx = Ausgang3
         Uedatx = Ausgang4
         Uedatx = 0
         Uedatx = 0
         Uedatx = 0
         Uedatx = 0

         Uedatx = 23
         Uedatx = 12
         Uedatx = 1                        
         Uedatx = 78                        
         Uedatx = 1                                        
         Uedatx = 180                                      
         Uedatx = 32
         Uedatx = 102

         Usb_ack_fifocon                                    ' Send data over the USB


      End If
   End If
 
End Sub                            

'this sub uses setFeature option
Sub Backlight()
   Usb_ack_receive_setup
   Bitwait Ueintx.rxouti , Set                              '  while(!Is_usb_receive_out());
   Ocr1b = Uedatx                                           'get value
   Usb_ack_receive_out

   Usb_send_control_in                                      '                // send a ZLP for STATUS phase
   Bitwait Ueintx.txini , Set
End Sub


'this function is called for user requests
Function Usb_user_read_request(type As Byte , Request As Byte) As Byte
  Usb_string_type = Uedatx                                  'Usb_read_byte();
  Usb_descriptor_type = Uedatx                              'Usb_read_byte();
  #if Mdbg
    'Print "USB_USER_READ_REQ; " ; Hex(type) ; "," ; Hex(request) ; "," ; Hex(usb_descriptor_type)
  #endif

  Usb_user_read_request = 0
  Select Case Request
     Case Get_descriptor:
        Select Case Usb_descriptor_type
           Case Report : Call Hid_get_report()
                         Usb_user_read_request = 1
           Case Hid : Call Hid_get_hid_descriptor()
                      Usb_user_read_request = 1
           Case Else
              Usb_user_read_request = 0
        End Select
    Case Set_configuration:
        Select Case Usb_descriptor_type
         Case Set_report : Call Hid_set_report()
                Usb_user_read_request = 1
         Case Set_feature : Backlight                       'call a sub that uses the passed data
                            Usb_user_read_request = 1
         Case Else
               Usb_user_read_request = 0
        End Select
   Case Get_interface:
        '//      usb_hid_set_idle();
      Call Usb_hid_get_interface()
      Usb_user_read_request = 1
   Case Else
     Usb_user_read_request = 0
 End Select
End Function

'usb_init_device.
'This function initializes the USB device controller and
'configures the Default Control Endpoint.
Sub Usb_init_device()
   #if Usbhost
      Usb_select_device
   #endif
   #if _chip = 70 Or _chip = 71
   If Usbsta.id = 1 Then                                    'is it an USB device?
   #endif
      Uenum = Ep_control                                    ' select USB endpoint
      If Ueconx.epen = 0 Then                               ' usb endpoint not enabled yet
         Call Usb_configure_endpoint(ep_control , Type_control , Direction_out , Size_32 , One_bank , Nyet_disabled)            '<---------------------------- Edit from me to 32
      End If
 #if _chip = 70 Or _chip = 71
     End If
 #endif
End Sub


'init the user endpoints
Sub Usb_user_endpoint_init(byval Nm As Byte)
  Call Usb_configure_endpoint(ep_hid_in , Type_interrupt , Direction_in , Size_16 , One_bank , Nyet_enabled)            '<---------------------------- Edit from me to 16
  Call Usb_configure_endpoint(ep_hid_out , Type_interrupt , Direction_out , Size_16 , One_bank , Nyet_enabled)          '<---------------------------- Edit from me to 16
End Sub

'the following data is all USB data
Usb_dev_desc:
Data 18 , Device_descriptor                                 ' size and device_descriptor
Data 0 , 2                                                  ' Usb_write_word_enum_struc(USB_SPECIFICATION)
Data Device_class , Device_sub_class                        ' DEVICE_CLASS  and  DEVICE_SUB_CLASS
Data Device_protocol , Ep_control_length                    ' device protol and ep_control_length
Data Vendor_id%                                             ' Usb_write_word_enum_struc(VENDOR_ID)
Data Product_id%                                            ' Usb_write_word_enum_struc(PRODUCT_ID)
Data Release_number%                                        ' Usb_write_word_enum_struc(RELEASE_NUMBER)
Data Man_index , Prod_index                                 ' MAN_INDEX and  PROD_INDEX
Data Sn_index , Nb_configuration                            ' SN_INDEX and NB_CONFIGURATION


Usb_conf_desc:
Data 9 , Configuration_descriptor                           ' length , CONFIGURATION descriptor
Data User_conf_size%                                        ' total length of data returned
Data Nb_interface , Conf_nb                                 ' number of interfaces for this conf. ,  value for SetConfiguration resquest
Data Conf_index , Conf_attributes                           ' index of string descriptor  , Configuration characteristics
Data Max_power                                              ' maximum power consumption


Data 9 , Interface_descriptor                               ' length ,  INTERFACE descriptor type
Data Interface_nb , Alternate                               ' Number of interface   ,   value to select alternate setting
Data Nb_endpoint , Interface_class                          ' Number of EP except EP 0  ,Class code assigned by the USB
Data Interface_sub_class , Interface_protocol               ' Sub-class code assigned by the USB  , Protocol code assigned by the USB
Data Interface_index                                        ' Index Of String Descriptor


Data 9 , Hid_descriptor                                     ' length  , HID descriptor type
Data Hid_bdc% , 8                                           ' Binay Coded Decimal Spec. release  , Hid_country_code
Data Hid_class_desc_nb , Hid_descriptor_type                ' Number of HID class descriptors to follow ,  Report descriptor type
Data Size_of_report%                                        ' HID KEYBOARD LENGTH

Data 7 , Endpoint_descriptor                                ' Size Of This Descriptor In Bytes    ,  ENDPOINT descriptor type
Data Endpoint_nb_1 , Ep_attributes_1                        ' Address of the endpoint   ,Endpoint's attributes
Data Ep_size_1%                                             ' Maximum packet size for this EP  ,   Interval for polling EP in ms
Data Ep_interval_1

Data 7 , Endpoint_descriptor                                ' Size Of This Descriptor In Bytes    ,  ENDPOINT descriptor type
Data Endpoint_nb_2 , Ep_attributes_2                        ' Address of the endpoint  ,  Endpoint's attributes
Data Ep_size_2%                                             ' Maximum packet size for this EP
Data Ep_interval_2                                          ' Interval for polling EP in ms


Usb_hid_report:
Data &H06 , &HFF , &HFF                                     ' 04|2   , Usage Page (vendordefined?)
Data &H09 , &H01                                            ' 08|1   , Usage      (vendordefined
Data &HA1 , &H01                                            ' A0|1   , Collection (Application)
'      // IN report
Data &H09 , &H02                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H03                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , Logical Minimum(0 for signed byte?)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte?)
Data &H75 , &H10                                            ' 74|1   , Report Size(Cool = field size in bits = 1 byte             '<---------------------------- Edit from me to H10
Data &H95 , Length_of_report_in                             ' 94|1:ReportCount(size) = repeat count of previous item
Data &H81 , &H02                                            ' 80|1: IN report (Data,Variable, Absolute)
'      // OUT report
Data &H09 , &H04                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H05                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , Logical Minimum(0 for signed byte?)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte?)
Data &H75 , &H10                                            ' 74|1   , Report Size(Cool = field size in bits = 1 byte
Data &H95 , Length_of_report_out                            ' 94|1:ReportCount(size) = repeat count of previous item
Data &H91 , &H02                                            ' 90|1: OUT report (Data,Variable, Absolute)
'      // Feature report
Data &H09 , &H06                                            ' 08|1   , Usage      (vendordefined)
Data &H09 , &H07                                            ' 08|1   , Usage      (vendordefined)
Data &H15 , &H00                                            ' 14|1   , LogicalMinimum(0 for signed byte)
Data &H26 , &HFF , &H00                                     ' 24|1   , Logical Maximum(255 for signed byte)
Data &H75 , &H10                                            ' 74|1   , Report Size(Cool =field size in bits = 1 byte               H10
Data &H95 , &H04                                            ' 94|1:ReportCount
Data &HB1 , &H02                                            ' B0|1:   Feature report
Data &HC0
                                                 ' C0|0    , End Collection
 
Back to top
View user's profile
katipefendi

Bascom Member



Joined: 24 Oct 2013
Posts: 30

blank.gif
PostPosted: Mon Nov 18, 2019 5:34 pm    Post subject: Reply with quote

has nobody idea?
I just want to know if my changes in the code are correct.

BR
Sinan
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4824
Location: Holland

blank.gif
PostPosted: Mon Nov 18, 2019 9:08 pm    Post subject: Reply with quote

you need to change Const Ep_control_length = 16 into 32
_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum