Author Topic: PIC16F1455 -- USB interface  (Read 37833 times)

0 Members and 1 Guest are viewing this topic.

Offline TeemoTopic starter

  • Regular Contributor
  • *
  • Posts: 58
  • Country: ee
Re: PIC16F1455 -- USB interface
« Reply #25 on: January 22, 2013, 04:21:57 pm »
Thank you astrononenov!  :-+
 

Offline JoannaK

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: fi
    • Diytao making blog
Re: PIC16F1455 -- USB interface
« Reply #26 on: January 23, 2013, 12:27:50 am »
Interesting comments at the Hardwareprolife.h file. Apparently some combination of the usb-capable chip+  demo-board will not work due excessive noise at the Vcc.

 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1685
  • Country: nl
Re: PIC16F1455 -- USB interface
« Reply #27 on: January 24, 2013, 04:44:17 pm »
Ok, so the main problem is that USB is nasty when it comes to timing. Microchip's stack works to some extent, but for some reason they noted in documentation that inperrupt driven operation is not recommended and experimental, so best solution is to use polling, which in many cases makes writing software pain in the ass. This is because USB requires control transfers typically once every 1ms. And if u ask: yes, I have tried interrupt driven operation, but the context switching time was very high and it caused problems with contant timing of other interrupts. You couldn't set that to low level, because it made connection unstable.

Another thing is that you CANNOT debug an MCU running USB, at least not without ICE debugger. This is because when you pause the program, the USB module also stops functioning, which means that PC detects USB fault and connection is lost. And the only way to recover the connection was to reconnect the usb and repower the MCU. I can't exclude possibility that it was USB stack which was at fault. And No, the USB module in PICs doesn't have any hardware protocol logic, only plain hardware layer which means that there is no handshake or control transfer automation and you have to do it all by yourself.

Another thing is that USB is a total pain in the ass when you would want to use it in other mode than virtual COM port. You not only have to write software for MCU but also develop a device driver for Windoze, which is task for a masochist.

Also: IIRC Microchip's stack had some weird licensing scheme, which forbode you from releasing you source code if the program contains the Stack, which is quite weird given that you can download that stack for free.

I think that claiming PICs superior transfer rate over FTDI+PIC is not necessarily right, because in case of FTDI you use it as a COM-port with high baudrate (FTDI website claims that some chips are capable of 3Mbaud) and in case of internal USB there is quite large code overhead and lots of CPU time is lost for dealing with packets etc.

You make it sound its all Microchips fault, but on other platforms it is exactly the same issue.

Some guys from NXP Cortex m3 devision gave a workshop at our college on their series of microcontrollers, and they said that debugging USB is a pain. It always will be. I do agree, a seperate FTDI USB chip is much easier, but much more expensive.

I've worked with USB on microchip parts, and once the hardware is up and running it isn't that difficult. I got a USB combined device running with a CDC COM Port + HID Joystick (4 analog axis, 32 buttons, POV hats etc.) in no time. Works a treat.
I used a PIC24FJ64GB004 in combination with a PICKIT2. Writing software without a debugger is doable, but takes a bit more time and effort.

I think such cheap controllers can be very interesting because you let it do the same thing as a FTDI chip, but alot much more if you write a little bit of software. For e.g. , you could have the PIC controller read system voltages, temperature, and connect the UART to your main controller which is application specific. Write a composite USB device, so you can have multiple UARTs, and dedicate one to system and one to the application. And that for 2$-3$ in parts cost + a little bit of development time.

For bigger controllers its doable to integrate it into 1 chip, but is more challenging as previously mentioned.

Moreover, with a CDC USB COM Port there is no issues with wrong baudrate, because there isn't any baudrate.
FTDI chips can run 3MBaud, but that's barely the UART section which connects to a FIFO buffer. The USB section only works fast in a limited set of conditions. I can't recall the maximum speed I achieved with both though..
« Last Edit: January 24, 2013, 04:50:57 pm by hans »
 

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: PIC16F1455 -- USB interface
« Reply #28 on: January 24, 2013, 04:54:54 pm »
The USB section only works fast in a limited set of conditions. I can't recall the maximum speed I achieved with both though..

I am running roughly 4mbits with a pic18f14k50 using bulk transfers and with an unoptimized asm code. I guess i could achieve at least 6mbits or even more, but since i only need ~300k for my application, i never took any efforts to make it faster.
 

Offline Subra

  • Newbie
  • Posts: 1
Re: PIC16F1455 -- USB interface
« Reply #29 on: February 19, 2013, 12:33:25 am »
I am new to PIC. I have been using Freescale so far. For my current application, the PIC16F1455 with USB interface looks perfect pricewise and capabilitywise. This is my question. PIC microcontroller will control a device based on input received via WiFi. The WiFi networking card connects wia USB port. If I connect this networking card to USB pins of PIC16F1455, will I be able to get the commands transmitted via WiFi? I need help in the USB area to extract the command.
Thanks,
Narayanan Subramanian
 

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: PIC16F1455 -- USB interface
« Reply #30 on: February 19, 2013, 02:38:31 am »
I am new to PIC. I have been using Freescale so far. For my current application, the PIC16F1455 with USB interface looks perfect pricewise and capabilitywise. This is my question. PIC microcontroller will control a device based on input received via WiFi. The WiFi networking card connects wia USB port. If I connect this networking card to USB pins of PIC16F1455, will I be able to get the commands transmitted via WiFi? I need help in the USB area to extract the command.
Thanks,
Narayanan Subramanian

You got the correct answer on the microchip forum. http://www.microchip.com/forums/fb.ashx?m=706959  You cannot use this PIC as it is not HOST capable. 
 

Offline ColdKeyboard

  • Contributor
  • Posts: 33
  • Country: ca
    • Sasa Karanovic
Re: PIC16F1455 -- USB interface
« Reply #31 on: July 09, 2013, 02:51:31 pm »
With the working example that astrononenov posted, I've managed to make Microchips HID - Custom Demo to work.

I had to edit the HardwareProfile file and also chagne some definitions (configuration bits) for this for work but as soon as I configured the device
correctly and burned down the hex file, I got notification that USB device is connected and Microchip example software is connecting to it without any problem. :)

I just wanted to say, astrononenov thank you very much for sharing your code! It really helped me alot! :)

Cheers!
I share most of my work at sasakaranovic.com
Also you can follow me @Twitter, @Facebook or contact me on Skype
 

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: PIC16F1455 -- USB interface
« Reply #32 on: July 09, 2013, 09:38:06 pm »
Interesting comments at the Hardwareprolife.h file. Apparently some combination of the usb-capable chip+  demo-board will not work due excessive noise at the Vcc.

Yes, I found the same issue on a proprietary stack not having taking close enough notice of your post on the comments in the hardwareprofile.h file.  Lucky it is just an easy fix and a correction to a out of spec hardware design. I was worried initially...
 

Offline iwl

  • Newbie
  • Posts: 3
AW: PIC16F1455 -- USB interface
« Reply #33 on: August 20, 2013, 03:36:49 pm »
Just compiled usbserial.zip and imediately worked on my New 1455 very good work to adapt it To the standalone chip from the demo board code.
Having an USB device with one 14Pin chip 2caps and some wires - amazing.
 

Offline george46

  • Newbie
  • Posts: 1
Re: PIC16F1455 -- USB interface
« Reply #34 on: October 07, 2014, 02:24:40 pm »
I have given up. Does anybody want to earn some bucks and put a working usb on a chip using the PIC16F1455 (OR THE PIC18F1455)?
I will provide the 1ms poll and using irqs are fine. Please respond only if you can work through a registered company.
 

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: PIC16F1455 -- USB interface
« Reply #35 on: October 08, 2014, 08:39:51 am »
I have given up. Does anybody want to earn some bucks and put a working usb on a chip using the PIC16F1455 (OR THE PIC18F1455)?
I will provide the 1ms poll and using irqs are fine. Please respond only if you can work through a registered company.

Damn! I deregistered my company.  :palm:

Pity, I don't expect anyone else has written USB stacks for the 16F1455 in both C and assembler...  :phew:
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC16F1455 -- USB interface
« Reply #36 on: November 04, 2014, 08:02:10 pm »
:the compiler would only do an 8-bit multiply. :

for sure, microchip isn't the gold standard for compiler development  but it is very hard to imagine that they got something this simple wrong, given the large installed base, long history of the compiler, and lack of user complaints on that particular issue.

maybe you can provide a short piece of code to demonstrate the issue?

otherwise, it sounds like overflowing, a mistake novice programmers sometimes make.
================================
https://dannyelectronics.wordpress.com/
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: PIC16F1455 -- USB interface
« Reply #37 on: November 04, 2014, 08:54:56 pm »
I didn't bother to dig into the C99 standard to see if this is allowed [it probably is if an 'int' is 16-bits on this machine], because now that it's working I just don't care and need to move on...
Just to be clear, XC8 only supports C90. And int is a 16-bit type, which is clearly stated in the documentation.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC16F1455 -- USB interface
« Reply #38 on: November 04, 2014, 09:07:56 pm »
I think it is a lot more convincing if you provide a piece of code demonstrating the bug. Otherwise, it is unverifiable and coding errors remain a real cause.

it is also fair to the compiler vendor too: if you were in their shoes, you would want facts, not some gut,s fuzzy recollection of what might have caused the issue.

hope it helps.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: PIC16F1455 -- USB interface
« Reply #39 on: November 13, 2014, 12:01:44 pm »
Quote
As it turns out, the compiler was morphing some constants into signed values when they should have been unsigned.

I think it is those incidents like that that really hurt your credibility. Lots of fluffy and no substance.

If you think the compiler has made a mistake, it is easy enough to just post the lines that the compiler had issues with and everyone could see for themselves what was not working.

Copy-and-paste the code is far more efficient to convince people of the compiler issues you have identified than all those words that mean nothing.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf