PIC18F6620 asking for advice - Page 1
Forum section: electronics / general

author: Berserk
author_rank: Contributor
timestamp: October 15, 2017, 08:04:57 am
content: Hello everyone, I want to ask you for advice about sending firmware to PIC18F6620 microchip.I am zero at programming microcontrollers, sorry, please help me if you can.I have some diagnostic module on PIC18F6620, after attempt to update firmware on that module via diagnostic software something happened and module has stuck.How can i reflash that chip? Do i need programmer like pickit3? Module board has 2 interface chips: com st232c, usb-com ft232rlFT_PROG can see their chip *FT232R USB UART* but it's allMPLAB IPE asking for programmer

author: Buriedcode
author_rank: Super Contributor
timestamp: October 15, 2017, 10:07:09 pm
content: That RJ-11 socket at the top right of the picture looks to be connected directly to PGM and PGC lines used for programming.How did you attempt to update the firmware? There could be a boot-loader on the MCU which means you can flash it via USB or serial, but there is no real standard - it will be a custom job, possibly via the diagnostic software (how does it connect to that?).It also depends on what file you have for flashing. A plain *.hex file that contains the config bits as well can be flashed directly to the MCU via that RJ-11 port, using a PIC programmer - most likely a PIC kit 3 as it is the cheapest, along with a 6-pin to RJ-11 adapter. But... if you update the firmware from the diagnostic software then it is entirely possible the file you have is specific for that bootloader - again, a custom file.Edit: just checked the hex, I cannot see the ID byte location (200000h apparently, found here:http://ww1.microchip.com/downloads/en/DeviceDoc/39583c.pdf) or any config words. So it looks like a hex file for a bootloader but I could be wrong! Normally bootloaders require an input to tell it to start reading in the new file, like a button, but often it checks first thing out of reset. If it normally connects to a PC via USB, it could be theres a line between the FT232 and the PIC that is toggled when updating the firmware. In that case, you should still be able to flash it via the diagnostic software.

author: Ian.M
author_rank: Super Contributor
timestamp: October 15, 2017, 10:25:56 pm
content: That's not a hex file, its a binary dump. However it does seem to start with opcodes that are plausible for a PIC18 reset and interrupt vectors.It *MAY* be possible to convert it back to an IntelHEX format file as required by Microchip's programming tools, and fix it up with parts of a hex file read from the device to provide CONFIG bit settings and any memory regions that aren't included in the dump, but it would be a *LOT* of work to do so.OTOH the device may be read protected and in that case although you should be able to recover the CONFIG settings, any bootloader present in high memory will be missing and the firmware will probably crash on powerup.

author: Berserk
author_rank: Contributor
timestamp: October 16, 2017, 07:05:13 pm
content: How can i convert .pic to .hex correctly?Attachment: saved config of corrupt device

author: Buriedcode
author_rank: Super Contributor
timestamp: October 16, 2017, 09:20:23 pm
content: Well, that may not be the best option. We don't know what software you used to update the firmware, how you connect this board to a PC or workstation, how the firmware is provided (downloaded from a site with instructions? handed to you on a USB drive?) etc..There is a standard way of programming that microcontroller, but quite often people use bootloaders to allow for easier firmware updates (that doesn't require a hardware programmer specifically for that line of microcontrollers), and those are usually custom.To me, it looks like it has a bootloader, which has either become corrupt, or the new firmware you are trying to update it with isn't compatible, or is rejected in some way.So, firstly, what software do you use to update the firmware? And..Is this whilst it is connected via USB? And..Does that software provide options to reset the device to default?

author: JTR
author_rank: Regular Contributor
timestamp: October 17, 2017, 12:02:31 am
content: Quote from: Berserk on October 16, 2017, 07:05:13 pmAttached is the bin file converted to hex with the config settings taken from your above file. No guarantees that this is all correct but it is a starting point and the disassembly looks sane.

author: Berserk
author_rank: Contributor
timestamp: October 21, 2017, 04:35:09 am
content: Quote from: JTR on October 17, 2017, 12:02:31 amIt's Alive! Everything worked after sending your file, Thank you very much, already recovered 3 devices.Thanks to everyone who tried to help me in that topic, you all are the best!