Helpful ReplyHot!In-field firmware updates

Page: 123 > Showing page 1 of 3
Author
Trevor Smith
Super Member
  • Total Posts : 205
  • Reward points : 0
  • Joined: 2013/07/22 11:42:07
  • Location: Peterborough UK
  • Status: offline
2018/12/05 06:29:18 (permalink)
5 (1)

In-field firmware updates

Hi all,
On a new project, I need a cheap way of implementing in-field firmware updates.
I’ve done before using PICKIT3’s in program-to-go mode, but even fake ones on Ebay are not that cheap …. and often don't get sent back !
I have a little “USB to TTL” converter thing from Banggood (£1.98 each), which might prove useful, but might be useless.
 
Been googling a lot, but still not really sure where to start yet.
 
So a few questions ......
I think mailing-out cheap USB sticks is the obvious favourite ……. maybe ?
Can the MCP2221 be used to bootload a PIC from a USB socket ?
How can I tell which PIC’s can “self-flash” ?
 
Apologies for any naivety here, but all ideas and help is appreciated.
Trevor
 
#1
Jim Nickerson
User 452
  • Total Posts : 5578
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: In-field firmware updates 2018/12/05 06:38:07 (permalink)
+1 (1)
I wonder which communications interfaces the target devices have available ?
#2
MBedder
Circuit breaker
  • Total Posts : 6558
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re: In-field firmware updates 2018/12/05 07:21:10 (permalink) ☄ Helpfulby Trevor Smith 2018/12/06 15:07:21
0
Get an USB OTG capable PIC, implement a mass storage + USB support in your firmware ant then just email the firmware file to your customers. They should copy the file to a flash drive, insert it into a PIC USB connector and turn the PIC power on [again].
 
This approach doesn't involve any additional hardware (and software drivers as well) - just a commonly used USB flash drive.
#3
KTrenholm
Super Member
  • Total Posts : 556
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: In-field firmware updates 2018/12/05 07:23:08 (permalink)
0
You should have no issues bootloading with a MCP2221.  I use an MCP2200 frequently for that exact purpose (using the GPIO as control pins for a mux which can redirect serial to multiple target devices).  As far as the host PC and PIC are concerned, it's just a serial port.
#4
NKurzman
A Guy on the Net
  • Total Posts : 16664
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: In-field firmware updates 2018/12/05 07:28:06 (permalink)
+1 (1)
An SD Card can be done with A SPI Port.

Yes a USB to serial adapter can be used with a bootloader.

For you PICKit3s you can charge them when you send it, and credit them if they return it.
#5
Antipodean
Super Member
  • Total Posts : 1668
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: online
Re: In-field firmware updates 2018/12/05 07:46:58 (permalink)
+1 (1)
KTrenholm
You should have no issues bootloading with a MCP2221.  I use an MCP2200 frequently for that exact purpose (using the GPIO as control pins for a mux which can redirect serial to multiple target devices).  As far as the host PC and PIC are concerned, it's just a serial port.




But the MCP2200 and MCP2221 are not USB Host devices - i took the post to mean he wants to use one of these to be able to plug a USB stick into his PIC device, and these will not do that.
 
Another altenative if you can buy cards like credit cards with an AT27C64 in them instead of the usual chip. These use standard I2C to comminucate, and are very cheap.
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#6
NorthGuy
Super Member
  • Total Posts : 5101
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: online
Re: In-field firmware updates 2018/12/05 07:49:50 (permalink)
+1 (1)
Our chips (made of PIC16F1454) provide on-board programming for one or two PICs and also UART-to-USB interface (and eventually debugging):
 
https://www.northernsoftware.com/nsdsp/brd/
 
#7
KTrenholm
Super Member
  • Total Posts : 556
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: In-field firmware updates 2018/12/05 08:02:54 (permalink)
0

But the MCP2200 and MCP2221 are not USB Host devices - i took the post to mean he wants to use one of these to be able to plug a USB stick into his PIC device, and these will not do that.



Indeed.
 
OP, the MCP2200/2221 can be used as an interface from USB from a PC to UART/I2C.  You can write a bootloader to use that interface.  You cannot use it to interface with a USB device.
 
 
Do not use my alias in your message body when replying, your message will disappear
...I just made this mistake and had to retype out my post... sad: sad
How dare I try and quote someone.
post edited by KTrenholm - 2018/12/05 08:26:57
#8
Jim Nickerson
User 452
  • Total Posts : 5578
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: In-field firmware updates 2018/12/05 08:07:37 (permalink)
0
Ant%69podean
. . .

Test url encode i in forbidden word
edit: just a thought, it works in forbidden url's
#9
pcbbc
Super Member
  • Total Posts : 516
  • Reward points : 0
  • Joined: 2014/03/27 07:04:41
  • Location: 0
  • Status: online
Re: In-field firmware updates 2018/12/05 08:27:10 (permalink)
+1 (1)
Add some kind of SPI socket and send out an SPI EEPROM which plugs into it.  In essence make your own proprietary memory card/stick.


The product selector doesn't seem to have a way to select self-programming.  I've a feeling most of the larger modern PIC designs support it.  You'd need to check the datasheet.
#10
Trevor Smith
Super Member
  • Total Posts : 205
  • Reward points : 0
  • Joined: 2013/07/22 11:42:07
  • Location: Peterborough UK
  • Status: offline
Re: In-field firmware updates 2018/12/05 09:11:18 (permalink)
0
Wow thanks guys,
JANickerson
I wonder which communications interfaces the target devices have available ?

I haven't chosen a PIC yet Jim, as I'm not sure which way this is all going yet.
MBedder
Get an USB OTG capable PIC, implement a mass storage + USB support in your firmware.

Looks ideal, but device packages and number of I/O is awkward, I need through-hole 44 pin ideally.
KTrenholm
You should have no issues bootloading with a MCP2221.  I use an MCP2200 frequently for that exact purpose (using the GPIO as control pins for a mux which can redirect serial to multiple target devices).  As far as the host PC and PIC are concerned, it's just a serial port.

So, yes MCP2221 can flash PIC from USB ?
(Other posts disagree)
NorthGuy
Our chips (made of PIC16F1454) provide on-board programming for one or two PICs and also UART-to-USB interface (and eventually debugging)

Thanks Northguy, I'll take a look.
 
 
#11
KTrenholm
Super Member
  • Total Posts : 556
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: In-field firmware updates 2018/12/05 09:29:52 (permalink) ☄ Helpfulby Trevor Smith 2018/12/06 15:08:15
0
You CAN:
Use an MCP2200/2221 to connect to your PIC to your PC through UART/I2C (PIC Side) to USB (PC Side) connection, and bootload over that connection.

This is OK
 
 
You CANNOT:
Use an MCP2200/2221 to connect a PIC to a USB slave device.
 [IMAGE CAPTURE2.PNG IS SUPPOSED TO GO HERE BUT I CAN'T EMBED IT WITHOUT "ACCESS DENIED"]
This will not work
 
[EDIT] Our amazing image embedding
post edited by KTrenholm - 2018/12/05 10:22:17

Attached Image(s)

#12
malaugh
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/03/31 14:04:42
  • Location: San Diego
  • Status: offline
Re: In-field firmware updates 2018/12/05 09:55:30 (permalink)
0
We use SD cards for field updates.  Its a much simpler interface and much less code to implement than USB.
 
On the hardware side you just need a SPI connection from the CPU to the SD card socket
On the firmware side you can use the FAFS library from http://elm-chan.org/fsw/ff/00index_e.html. If you option the library to only read files and have no sub-directories, the code can be very small.
 
Than you just need to write code to open a file on the SD card, read a block of data, write the block to the program memory, repeat, then close the file.
We have a program running on the PC that processes the hex file for the new firmware to a image of how the code looks in memory, so transferring the data from the SD card to program memory is a simple copy
 
#13
MBedder
Circuit breaker
  • Total Posts : 6558
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re: In-field firmware updates 2018/12/05 10:00:43 (permalink)
0
Most of the suggested solutions involves the client side USB driver installation which often gives a lot of headaches. The USB Flash/SD card approach is preferred in all aspects.
#14
Trevor Smith
Super Member
  • Total Posts : 205
  • Reward points : 0
  • Joined: 2013/07/22 11:42:07
  • Location: Peterborough UK
  • Status: offline
Re: In-field firmware updates 2018/12/05 10:17:26 (permalink)
0
Thanks Malaugh,
Reading about it now ...... looks nice !
Trevor
#15
Jim Nickerson
User 452
  • Total Posts : 5578
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: online
Re: In-field firmware updates 2018/12/05 10:22:12 (permalink)
0
I have found in my systems using SD cards the timing had to be changed quite a few times as different SD cards were used.
I also found inserting the SD card while the system was powered up frequently reset the processor as the SD card started up.
#16
NorthGuy
Super Member
  • Total Posts : 5101
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: online
Re: In-field firmware updates 2018/12/05 10:40:58 (permalink)
0
MBedder
Most of the suggested solutions involves the client side USB driver installation which often gives a lot of headaches.



Not necessarily. Drivers for HID devices are automatically present in all major OSes and work very reliably.
#17
MBedder
Circuit breaker
  • Total Posts : 6558
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re: In-field firmware updates 2018/12/05 10:46:31 (permalink)
0
CDC is not HID, and the MCP22xx mentioned above as well as most others (FTDI, Prolific, Silabs etc.) are CDC, not HID.
#18
KTrenholm
Super Member
  • Total Posts : 556
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: In-field firmware updates 2018/12/05 10:51:45 (permalink)
0
For the 22XX, It's two devices.  A CDC for the Virtual COM Port, and a HID device for the GPIO/EEPROM.
 
I think Windows comes with a CDC driver in 8.1/10.  Not sure about 7 or earlier.
#19
MBedder
Circuit breaker
  • Total Posts : 6558
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re: In-field firmware updates 2018/12/05 11:00:55 (permalink)
0
8.1/10 still require the chip manufacturer's specific driver installation, and it still doesn't work reliably.
#20
Page: 123 > Showing page 1 of 3
Jump to:
© 2018 APG vNext Commercial Version 4.5