Author Topic: Quick and Easy PIC config over USB  (Read 3171 times)

0 Members and 1 Guest are viewing this topic.

Offline katzohkiTopic starter

  • Frequent Contributor
  • **
  • Posts: 378
  • Country: us
    • My Blog
Quick and Easy PIC config over USB
« on: December 31, 2014, 07:23:45 pm »
OK, so maybe I'm dreaming. I want the user to be able to change a simple configuration of my PIC application over USB and I'm looking for a simple solution. It seems like the easiest thing would be to put a USB storage module on-board, which the PIC can access and read the configuration file when the USB is off. The other idea would be to put a USB-Serial part on board and write an application that communicates with the PIC directly (I'm a bit out of practice for this I think). The final option I thought of was to use a PIC that can communicate over USB directly, but that strikes me as a lot of effort, especially since the application runs on a PIC10 now and I'd have to use at least a PIC16.

The config information is a string and a couple settings or so (may as well be strings too). Any ideas? All input is appreciated.
 

Offline Christopher

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Quick and Easy PIC config over USB
« Reply #1 on: December 31, 2014, 08:16:07 pm »
A usb->serial chip might as well cost as much as a cheap USB pic.

At with the PIC you can make it a flash drive with a simple text file in it .
 

Offline katzohkiTopic starter

  • Frequent Contributor
  • **
  • Posts: 378
  • Country: us
    • My Blog
Re: Quick and Easy PIC config over USB
« Reply #2 on: December 31, 2014, 08:32:06 pm »
A usb->serial chip might as well cost as much as a cheap USB pic.

At with the PIC you can make it a flash drive with a simple text file in it .

I'm ok with the cost of adding the USB to serial chip. It's the development time I'm worried about.

Are you saying that you can make the PIC look like a simple flash drive with text file?
 

Offline Christopher

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Quick and Easy PIC config over USB
« Reply #3 on: December 31, 2014, 08:33:46 pm »
The usb to serial would be easy as it's literally a uart and u arts on the pic are very simple


Microchip has a usb stack with usb thumb drive example. Check it out.
 

Offline lewis

  • Frequent Contributor
  • **
  • Posts: 704
  • Country: gb
  • Nullius in verba
Re: Quick and Easy PIC config over USB
« Reply #4 on: December 31, 2014, 09:14:27 pm »
Communicate with the PIC via a USB to UART chip (eg FT232 - make sure you use a genuine one!) and store whatever configuration you need in PIC's internal EEPROM (or Flash if the PIC doesn't feature EEPROM).

You'll need to write an application for the PC end in order to get the data into the PIC. Lots of free tools (code::blocks) available to do that and google has some examples of source code like this one: https://batchloaf.wordpress.com/serialsend/. It can be modified to send files.

There are more elegant ways to do it, but this is probably the simplest.
I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.
 

Offline katzohkiTopic starter

  • Frequent Contributor
  • **
  • Posts: 378
  • Country: us
    • My Blog
Re: Quick and Easy PIC config over USB
« Reply #5 on: December 31, 2014, 10:13:43 pm »
Thanks guys! This is great. I don't think I'll try to make it work like a USB thumb drive. It would be cool, but the USB to UART will be easier to handle. I didn't want to have to write too much of a user program, but based on your example I think I can keep it very simple. Probably just have a .txt config file and a program that will translate and send it.
 

Offline Christopher

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Quick and Easy PIC config over USB
« Reply #6 on: January 01, 2015, 03:17:17 pm »
Visual c# express 2010 is a free download and great for making little serial guis.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Quick and Easy PIC config over USB
« Reply #7 on: January 02, 2015, 12:06:09 am »
Visual c# express 2010 is a free download and great for making little serial guis.
Just an FYI:
Visual Studio Community 2013 is free and has all the compilers including c# and it's the full Visual Studio Professional without the limitations that the Express editions have.

But I don't even know if the OP is running windows.
 

Offline katzohkiTopic starter

  • Frequent Contributor
  • **
  • Posts: 378
  • Country: us
    • My Blog
Re: Quick and Easy PIC config over USB
« Reply #8 on: January 02, 2015, 09:10:54 pm »
Thanks all, good info. I haven't programmed in C lately, but I've had classes in C++ and the .NET framework so I should be able to handle. I'll have to check out the free C# programs.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Quick and Easy PIC config over USB
« Reply #9 on: January 02, 2015, 11:33:48 pm »
Use a serial port, thats the most compatible and fastest. Especially when you're using ftdi, almost every computer nowadays knows how to use those.
Then get Qt and make a portable application that can run either windows/mac/linux. Avoid the microsoft vendor lock, because they are toying with their future in the recent Windows versions.

Have some though of way to communicate. Keeping it extensible en small. (See modbus)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf