16F88 int-8MHz keeps retring, no download

Support for Bloader and Screamer

Moderator: phalanx

16F88 int-8MHz keeps retring, no download

Postby lovefool » Sun Apr 30, 2006 10:16 am

Hello, I have been working on a 16F88 baord that will be loaded in a RC model airplane. So now I need to reprogram often in the field, and found this boot loader. I have made small test circuit on a bread board, but I can't download serial-test program. Screamer both 1.4 and 1.6 keeps retring.

I have followed the instruction on the page, I got OK on hyperterminal and LED blink soon after writing Boot loader. Then stated screamer and downloading SerialTest-88-Internal8MHz.hex, and press switch, the screamer continue incrementing Retry counter after receiving a broadcast message. After aborting download, I will get no OK and LED blink, so I guess this mean some program has been written. Also I got an error of screamer 1.6 when I try to open hex file. (runtime 75) Any advice will be appriciated.

Circuit :
16F88 internal 8Mhz,
LED on A0,
MCLR pull-up by 10k and small switch to GND,
serial connection through Dallas DS275 (only Rx, Tx) and CTS/RTS are jumpered in the connector.
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Sun Apr 30, 2006 12:32 pm

I do know that Screamer does work with the 16F88, as I often use it on projects around the lab. You will have problems if the device resets during the downloading, though. If I recall correctly, the bootloader will erase the program space (except for the bootloader code), which includes the reset vector at location 0. If the program isn't successfully downloaded, you have to reflash the bootloader so the vector gets restored. So, at least for testing, turn off the watchdog timer and brown-out detection. You already have a 10k pull-up on MCLR. I suppose an excessively bouncy switch could cause problems, but I've never experienced that.

Did you confirm that Screamer was set to 9600 baud, 16F88, and 8Mhz oscillator? When switching between PIC devices, I sometimes forget to change the settings. Also, you know that the PIC is able to send data to the PC, but check to see if data from the PC is getting to the PC (PORTB, 2). It appears that the DS275 inverts the signals which is what a MAX232 does, so that shouldn't be the issue.
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Sun Apr 30, 2006 6:48 pm

riden - thank you for your advice.

I have setup screamer with 9600bps, 16F88, 8MHz. Also I have tried cycling power, not using switch. If I use another buad rate, I got another errors.

I have read the program from PIC after trying downloading serial-test.hex. Except first three words and bootloader itself, program area had been erased.

I have been using DS275 as a replacement of MAX232 (8pin dip, no caps required) for several months and had no problem.

I will check the circuit, wire connection....
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Sun Apr 30, 2006 7:23 pm

You're welcome, but it looks like you did your investigating before the post.

I looked at the bootloader code and the PIC sends an ENQ (ASCII 5) and waits for an ACK (ASCII 6). Failing that, or if the unit times out, the loader transfers control to the regular PIC program. Once it gets the ACK, though, it clears out the program space. So, given the fact that the memory is erased, the PIC must have handshaked with the PC.

I'm sorry that I don't have any more ideas at the moment, but perhaps others may think of something.
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Sun Apr 30, 2006 7:30 pm

riden - thanks again. I tried to modify the board I made two years ago for 16F628 for test, but later I have found Rx/Tx pins are different pins.

I could see ENQ (05) when I start hyperterminal and reset PIC, but didn't know ACK (06) had been sent from PC to PIC. I will install serial line monitor program on this PC and look what kinda data is on the line.
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Sun Apr 30, 2006 7:37 pm

You must be getting the ACK back from Screamer since the loader is erasing the program memory Here is the beginning of the handshaking sequence...

Code: Select all
PIC  Sends ENQ (5) TO PC
PC   Sends ACK (6) TO PIC
PIC  Sends "T" TO PC
PC   Sends ":" TO PIC

And then things progress from there. BTW, the C source for the loader is in the Screamer 1.4 distribution. That is where I got the info about the handshake process.
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Sun Apr 30, 2006 8:19 pm

Here is the result of serial port sniffing. After <ACK> and before "T", there are several characters like "3"<SI><NUL> .....


DTR off
Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR
COM port is closed
COM port is opened
In/out queue size 1024/512
Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR
Set timeouts: ReadInterval=-1, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=5000
Baud rate 9600
RTS off
DTR on
Data bits=8, Stop bits=1, Parity=None
Set chars: Eof=0x1A, Error=0x00, Break=0x00, Event=0x00, Xon=0x11, Xoff=0x13
Handflow: ControlHandShake=1, FlowReplace=0, XonLimit=256, XoffLimit=256

<ENQ>
<ACK>3
<SI><NUL>T
:<BS><NUL><NUL><NUL>???)<SUB>
<BEL>
:<BS><NUL><NUL><NUL>???)<SUB>
<BEL>
:<BS><NUL><NUL><NUL>???)<SUB>

keep continues ....
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Sun Apr 30, 2006 9:04 pm

I forgot to include some important information.

After the ENQ from the PIC and the ACK from the PC, the PIC will wait for the PC to send the baud rate value for SPBRG (one byte). The program memory will be cleared after receiving this data. Then the PIC will send two bytes to specify the high/low parts of the bootloader program.

After all this, the PIC will enter the download loop by sending "T".

When the PC starts a new block, it sends ":" followed by the number of bytes in the block, the high/low parts of the address, the checksum for the bloick, followed by the block data.

If the PIC received the data and the PIC's calculated checksum agrees, the PIC writes the flash and sends "T" which begins the process again. If checksums don't agree, the BEL (ASCII 7) character is sent and PC should resend that block.

I didn't mean to hit you over the head with details, but I wanted to explain the data you're seeing. It looks the basic data transfer is working but the PIC says the checksum doesn't agree and sends BEL. The new data block was never written.

Hope this helps more than confuses. :)
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Mon May 01, 2006 4:29 am

riden - no confuse at all. Thank you for your good explanation. I will log data with binary, then look value sent from PC is reasonable or not.
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby lovefool » Wed May 03, 2006 4:58 pm

Before analysing packets and checksum error, I have modified a board I used to use with 16F628 and MAX232. (Pin assign for RX/TX are different) I tested bootloader on this board with 16F88, I got same problem. I am wondering Bloader-F88-Internal8MHz.hex correctly compiled and verifed working.....
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby lovefool » Wed May 03, 2006 5:19 pm

This is the log ... and checksum looks not correct

first line of SerialTest-88-Internal8MHz.hex is
:020000001A29BB
~~~~~~~~~~~~~~~~~~~~~~
PIC>05 ENQ
PC > 0633 ACK+3
PIC>0F0054 0F00+T
PC > 3A08 0000 003F FF3F FF3F FF29 1A :08 0000 003F FF3F FF3F FF29 1A
PIC>07 BELL
PC > 3A08 0000 003F FF3F FF3F FF29 1A :08 0000 003F FF3F FF3F FF29 1A
PIC>07 BELL

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PIC program:
1)Set baud rate 9600 (SBPREG=51)
2)Send ENQ(0x05)
3)Wait for ACK(0x06)
4)Read next character and set baud rate (SBPREG=0x33=51)
5)Erase memory
6)Send BLOADER_START_HIGH (0x0F)
7)Send BLOADER_START_LOW (0x00)
8)Send "T"
9)Wait for ":"
10)Read record length (1byte "0x08")
11)Read address high (1byte "0x00")
12)Read address low (1byte "0x00")
13)Read checksum (1byte "0x00")
14)Repeat read data for record length (8bytes "3F-FF-3F-FF-3F-FF-29-1A")
15)Calculate checksum (result is 0x05, not 0x00)
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Wed May 03, 2006 8:57 pm

Perhaps the serial test file is defective. It is too late for me to try to download it into my 16F88 tonight, but I have a small test program that will echo characters at 2400 baud that you could download with Screamer. Here is the link to the HEX file and sample code: Echo 2400 baud. That program is currently running on a 16F88 with the 8Mhz internal oscillator. Let me know if that works and I'll try to download the serial test program tomorrow night, if necessary.

Ralph
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Thu May 04, 2006 1:24 pm

riden - I will try your code tonight. Thanks .... Soon after I fix this probelm, I will install VB on my machine and try to change screamer to support COM11. Is Visual Basic version 6 ?
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Postby riden » Thu May 04, 2006 2:52 pm

I'm not positive, but I believe it was done in VB6. I'll scrape around tonight for some COM port enumeration code (I have some for Delphi) and pass it along. I also may impose on you to incorporate another change to allow Screamer to directly download hex files created by Proton+. No hurry for either of these changes, though.

Let me know if my sample code works on your board. Remember, it uses Screamer to download at 9600 baud, but the program outputs 'test' over and over at 2400 baud.

Ralph
riden
Support Volunteer
 
Posts: 1754
Joined: Fri Jun 03, 2005 10:41 pm
Location: Illinois

Postby lovefool » Thu May 04, 2006 7:18 pm

Still no luck ..
I have tried your code, serial-test, my program (CCS C) .... same result on 1.4, 1.6 & 1.7. I thought some DLL or OCX are corrupt, so I installed Visual Studio 6 (VB and VCC) together with SP5, SP6, still same.

Is there any requirement on PC side ???
lovefool
 
Posts: 11
Joined: Sun Apr 30, 2006 10:02 am

Next

Return to Boot Loading

Who is online

Users browsing this forum: No registered users and 1 guest