Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Virtual USB-port for AVR
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 20, 21, 22  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Petr_
member
member


Joined: 24 Mar 2010
Posts: 46

blank.gif
PostPosted: Sun Feb 19, 2012 3:54 pm    Post subject: Reply with quote

ollopa wrote:
I'm attaching version 1.06 of the library for now.
Normally works.
Submitted by 240000 packages and there is no error.
Thank you.

Back to top
View user's profile
ollopa
member
member


Joined: 03 Sep 2007
Posts: 233
Location: California

usa.gif
PostPosted: Sun Feb 19, 2012 7:19 pm    Post subject: Reply with quote

Thanks for verifying Smile I no longer see errors no matter how long I let it run. Here's one over 3,000,000 loops. Surprised
Back to top
View user's profile
albertsm
Site Admin
Site Admin


Joined: 09 Apr 2004
Posts: 3243
Location: Holland

blank.gif
PostPosted: Sun Feb 19, 2012 9:07 pm    Post subject: Reply with quote

well done, thanks for the updates!
_________________
Best regards,

Mark Alberts
MCS Electronics

http://www.mcselec.com
Back to top
View user's profile Visit poster's website
Gerwin
member
member


Joined: 15 May 2007
Posts: 3

netherlands.gif
PostPosted: Wed Mar 07, 2012 4:19 pm    Post subject: Reply with quote

is it possible to send data to a hid keyboard beside the capslock and numlock etc?

Or do i have to write a driver then?

And do i have to use a own vendor and product id? even if it is a keyboard?

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit
Back to top
View user's profile
ollopa
member
member


Joined: 03 Sep 2007
Posts: 233
Location: California

usa.gif
PostPosted: Wed Mar 07, 2012 6:51 pm    Post subject: Reply with quote

You can implement vendor-defined control transfers and send arbitrary data to the keyboard. You won't have to write a driver but you may need to use a framework like libusb to initiate the transfer.

You could also use custom defined feature reports and the native Windows API to send them.

If you're working on your own personal project, you can make up a vendor id and product id, as long as they don't conflict with any other device you use.
Back to top
View user's profile
Gerwin
member
member


Joined: 15 May 2007
Posts: 3

netherlands.gif
PostPosted: Wed Mar 07, 2012 9:16 pm    Post subject: Reply with quote

Ah i going to try with the custom defined reports.

Thanx for the answer.

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit
Back to top
View user's profile
vanphu
member
member


Joined: 27 Jul 2009
Posts: 93

vietnam.gif
PostPosted: Sat Apr 07, 2012 8:53 am    Post subject: Reply with quote

Hi everybody!

I have a problem with project (AN #178)
I already have download lib "SWUSB.LBX"

but the code in AN#178 have error in line below

_usb_crc = Crc16uni(txstate(3) , Count , &HFFFF , &H8005 , 1 , 1)


can you help me?

thank you very much.

_________________
Best Regards
Van Phu
Back to top
View user's profile
Mrshilov
member
member


Joined: 24 Jan 2009
Posts: 123
Location: Russia

russia.gif
PostPosted: Mon May 28, 2012 12:02 am    Post subject: Reply with quote

Mr.Ollopa, how can I use two Interface Descriptor with whis library (if it possible)? I need to make HID-keyboard with some Multimedia keys.
Back to top
View user's profile
Mrshilov
member
member


Joined: 24 Jan 2009
Posts: 123
Location: Russia

russia.gif
PostPosted: Sat Jun 09, 2012 5:05 pm    Post subject: Reply with quote

It is really possible to make 2 interfaces with this library Very Happy !
I simpy add second Interface, HID, Endpoints and Report descriptors and make a choice to choose one of two Report descriptor in Sub Usb_processsetup:
Code:
......................
Case &B10000001:
         Select Case _usb_rx_buffer(3)
'            CASE _usb_REQ_GET_STATUS:
'            CASE _usb_REQ_GET_IFACE:
            Case _usb_req_get_descriptor
            '_usb_rx_buffer(4) is the descriptor index and (5) is the type
               Select Case _usb_rx_buffer(5)
                  Case _usb_desc_report:
                         Case _usb_desc_report:
                            If _usb_rx_buffer(6) = 0 Then Restore _usb_hid_reportdescriptor       'first interface  !!!!!!!!!
                            If _usb_rx_buffer(6) = 1 Then Restore _usb_hid_reportdescriptor1     'second interface  !!!!!!!!!
                         End Select
                     Senddescriptor = 1
'                  CASE _usb_DESC_PHYSICAL
'                  CASE _USB_DESC_HID
               End Select
         End Select
..........................
.
And it works!!!
Back to top
View user's profile
ollopa
member
member


Joined: 03 Sep 2007
Posts: 233
Location: California

usa.gif
PostPosted: Thu Jun 14, 2012 5:17 pm    Post subject: Reply with quote

Very Happy

Sorry for the late reply. I'm glad to hear that it worked! I think you're the first to try it. If you're willing, please post the full example when you're done. I'm curious to see exactly what you've done Smile
Back to top
View user's profile
ollopa
member
member


Joined: 03 Sep 2007
Posts: 233
Location: California

usa.gif
PostPosted: Thu Jun 14, 2012 5:22 pm    Post subject: Reply with quote

vanphu wrote:
Hi everybody!

I have a problem with project (AN #178)
I already have download lib "SWUSB.LBX"

but the code in AN#178 have error in line below

_usb_crc = Crc16uni(txstate(3) , Count , &HFFFF , &H8005 , 1 , 1)


can you help me?

thank you very much.



I think it's time for the appnote to be updated. The included version of SWUSB.LBX is out of date -- the updated one now has its own crc routine that is slightly faster and smaller than using the generic Crc16uni.

Can you say what version of BASCOM and SWUSB.LXB you are using and also post the text of the error you are getting?
Back to top
View user's profile
vanphu
member
member


Joined: 27 Jul 2009
Posts: 93

vietnam.gif
PostPosted: Thu Jun 14, 2012 7:32 pm    Post subject: Reply with quote

Hi ollopa,
I was update the version of Bascom,
It ok and not have error.
Thank you very much,

_________________
Best Regards
Van Phu
Back to top
View user's profile
Mrshilov
member
member


Joined: 24 Jan 2009
Posts: 123
Location: Russia

russia.gif
PostPosted: Thu Jun 14, 2012 7:40 pm    Post subject: Reply with quote

ollopa wrote:
...please post the full example when you're done...

This is example of USB-HID-Multimedia keyboard. It is simple, but enough to understanding.
Changed lines marked with !!!, added lines - with ***.
(Option to store USB descriptors in EEPROM now not working, don't try it.)
Back to top
View user's profile
Mrshilov
member
member


Joined: 24 Jan 2009
Posts: 123
Location: Russia

russia.gif
PostPosted: Wed Jun 27, 2012 4:51 pm    Post subject: Reply with quote

Mr.Ollopa, I try to exchange with PC via Feature cannel, but has some strange results. I add Feature to second hid_report_descriptor:
Code:

Data &H06 , &H00 , &HFF                                     'Usage_page(vendor Defined Page 1)
Data &H09 , &H01                                            'Usage(vendor Usage 1)
Data &HA1 , &H01                                            'Collection(application)
Data &H85 , &H03                                            ' Report ID (3)
Data &H09 , &H00                                            ' Usage(undefined)
Data &H15 , &H00 ,                                          ' Logical_minimum(0)
Data &H26 , &HFF , &H00                                     ' Logical_maximum(255)
Data &H75 , &H08                                            ' Report_size(Cool
Data &H95 , &H08                                            ' Report_count(Cool
Data &HB1 , &H02                                            ' Feature(data , Var , Abs)
Data &HC0                                                   'End_collection
 

To input data I add to Sub Usb_processsetup:
Code:
Case &B00100001
         Select Case _usb_rx_buffer(3)
            Case _usb_req_set_idle
               Idlemode = 1
               Call Usb_send(txstate , 0)

            Case _usb_req_set_report                        ' SET_REPORT Feature
              If _usb_rx_buffer(5) = _usb_req_set_feature Then
               Call Usb_send(_usb_tx_status , 0)
               
               For K = 1 To 8                        
                  Writeeeprom _usb_rx_buffer(k + 13) , k   'save data
               Next K

               End Select
              End If
         End Selec

I receive from PC only 7 bytes and it stored in _usb_rx_buffer(14)..._usb_rx_buffer(20).

To send data I add to Sub Usb_processsetup:
Code:
Case &B10100001
        Select Case _usb_rx_buffer(3)
          Case _usb_req_get_report                          ' GET_REPORT Feature
          If _usb_rx_buffer(5) = _usb_req_set_feature Then
            For K = 2 To 9
               _usb_tx_buffer(k) = 1
            Next K
            Call Usb_send(_usb_tx_status , 8)
          End If
        End Select

But nothing happens, no event, no data.
Can You help?
Back to top
View user's profile
tiket
member
member


Joined: 14 Apr 2005
Posts: 29

PostPosted: Thu Jun 28, 2012 2:07 pm    Post subject: Reply with quote

Hi, to all.
I compiled all samples in this thread for MEGA25161 but PC with Windows7 not find the device.
Last test was USB_HID_Keyboard.zip of mr. Hollopa but not work.
I'm powering micro with 5Vcc and have shifted level of D+ and D- with 3.6V zener diodes.
I have a doubt, the micro is working with 16MHz crystal is this clock supported?
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 20, 21, 22  Next
Page 16 of 22

 
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