Page 1 of 1

USB support ?

Posted: Sun Jan 21, 2007 9:47 am
by octal
Hi David,
sorry to post again about USB, but when ca we expect it to be ready? Can I have the beta version ? I'm making a serial chips programmer and have (re)written most of the routine in SF Basic, and my programmer is working fine, but I'm communication with it using RS232 and I would like to do it using USB. If I buy the commercial version of SFCompiler, can I have USB (even if it's in beta state)? if no, is there any way so that I become (an official) beta tester of SFCompiler ?

Best regards

Posted: Sun Jan 21, 2007 7:08 pm
by David Barker
As soon as I have something ready I will post an announcement on the forum. The code is rather complex and I won't be releasing it until I'm sure it all works OK. It's all written in Swordfish BASIC, no ASM...

I am implementing both USB HID and CDC. The HID module offers transfer rates of 64KBytes second (which is the max for HID). The CDC module will work like the USART module does but also allows CDC block write which can transmit data at arount 420KBytes second (3.4 Mbits), assuming the USB bus isn't loaded too much.

Unless there are any show stoppers during testing and that I can document it in time, I would estimate mid february for a release.

Posted: Mon Jan 22, 2007 11:08 am
by xor
David Barker wrote:It's all written in Swordfish BASIC, no ASM...
Truly amazing... :D
I am implementing both USB HID and CDC. The HID module offers transfer rates of 64KBytes second (which is the max for HID). The CDC module will work like the USART module does but also allows CDC block write which can transmit data at arount 420KBytes second (3.4 Mbits), assuming the USB bus isn't loaded too much.
Bonus.... this I will certainly have to try.... :D :D :D

One thing missing from all good USB code work is what the programmer learned about USB along the way. Explaining and expressing it with some sense of clarity for beginners has been the pitfall of many writers on the subject, including Jan Axelson, who has written some very well commented PC side code, but her book is not as helpful. Dave, if you're up to the task, I think another book/article on the subject.....especially with respect to microcontrollers...has possibilities.

Posted: Mon Jan 22, 2007 8:12 pm
by David Barker
Well, you certainly do pick up a few things along the way although I have to admit that the main 'USBSystem' module is a port from the microchip C libraries. I've pretty much left the code as is, so this should allow people who want to dig really deep into USB to reference much of the microchip documentation.

USB Complete by Jan Axelson was a lifesaver and really helped me get a grip with many of the concepts.

I doubt very much if I will have the time for a detailed article on the subject - the CDC and HID modules I've implemented are very easy to use. However, support will be through some simple examples, the online help and this forum.

The CDC library is really easy. It's just like using the USART library - nothing to learn really. HID is a little more tricky as it requires some work on the PC side to read and write data. I'm going to update EasyHID to for Swordfish to automate much of this process, for those people who don't want to use the API calls. There are some nice touches with the Swordfish HID module though. You can basically map structures onto HID reports which makes using HID on the PIC side a breeze. For example,

Code: Select all

// TX report...
structure TTXReport
   Time as word
   Message as string
end structure
dim TXReport as TTXReport absolute TXReportRAM  

...

HID.TXReport.Time = 12345
HID.TXReport.Message = "WAITING..."
HID.WriteReport
As you can see, it's really easy to send data of different types (strings, words etc)

However, if you want to send big blocks of data, it's easy also. For example,

Code: Select all

dim Buffer(256) as byte
HID.WriteArray(Buffer)
Actually, I've also mapped some buffers onto the MCUs USB dual port RAM. All this means is that you have a 'free' 256 Byte buffer to use as you wish. That is, it won't eat into your main program RAM.

Posted: Mon Jan 22, 2007 8:55 pm
by xor
David Barker wrote:USB Complete by Jan Axelson was a lifesaver and really helped me get a grip with many of the concepts.
Being totally green with USB last summer I bought and read her book with little success of getting through the complexity. I then poured through her VB HID example and it was instantly clear....nearly...but I was on my way to programming HID. Maybe going back now and re-reading it I'll find it more informative and instructive.
I doubt very much if I will have the time for a detailed article on the subject - the CDC and HID modules I've implemented are very easy to use. However, support will be through some simple examples, the online help and this forum.
Many users think in terms of plug-n-play when setting up HID on their PIC's, not even realizing that the PC must be programmed also. Looking at the comments on other forums, PIC HID is a blessing for those who get it and have it working, and also a curse because it's an impossible task to explain the function of the library in a short paragraph to someone just starting.
The CDC library is really easy. It's just like using the USART library - nothing to learn really.
I know nothing about it but I'm ready to try it. SWF is going to sell itself with a library of this caliber.

Posted: Mon Jan 22, 2007 8:56 pm
by octal
Hummm ... very interresting ... when it will be delivered David ... I hope to test it very soon !!!

Posted: Fri Jan 26, 2007 6:21 pm
by David Barker

Posted: Fri Jan 26, 2007 6:26 pm
by octal
Great news David ... great ...
I'll download it now and do test this weekend ...
Best regards

Posted: Fri Feb 02, 2007 10:33 am
by Alfch
Hi

Is a Mass Storage USB module 'on the rail' ?
I had success with Microchip C18 and their mass strorage framework but I'm not very 'comfortable' with this tool !!!

Regards

Posted: Fri Feb 02, 2007 3:48 pm
by David Barker
I have no plans to do this at the current time.

However, I think it would be possible to introduce the class specifics into 'USBSystem.bas' to support it, in much the same way as HID and CDC has been implemented.