Issues programming the AT89C51I2C about 10% of the time - Page 1
Forum section: electronics / general

author: --Oz--
author_rank: Regular Contributor
timestamp: June 24, 2021, 11:20:28 pm
content: Issues programming the 89C51I2C about 10% of the time.I use Atmel FLIP programming GUI (v3.4.7) and about 10% of the time it fails to program. (out of a 100 boards a week, ~10 fail to program)I program through the USB cable on a Win10 PC and a FTDI chip mounted on each board (virtual comm port).I connect at 9600 baud, then click run on flip, it always passes the erase flash portion, then ~10% of the time it fails timeout on flashing the program.Then someone mentioned to try lower than 9600, well Flip does not have this option (or does it, maybe some command line, or hidden debug mode)?I was told to try TSim51 (the ISP portion) as it allows any baud rate you want, and guess what around 8000~8500 baud it connects, erases, programs, verifies fine, but, it fails to run the program on reset (some magic is happening with FLIP, I am not a programmer, I tried all the checkbox option in TSim51 and no luck). So if I can get FLIP to use a 8000~8500 baud, I would be a happy camper.Any other programs that will program the Atmel AT89C51I2C through USB that will allow a lower than 9600 baud?More Info:After more google searching, I found a old google cached flip manual, itshows osc-freq/baud pairs that are known to work, this was a great find. Our board has a 20Mhz osc and its not on the list (picture below). I recently found a red headed stepchild board so stubborn it would not program for anything. I removed the crystal/caps, hooked up my signal generator and tried 20MHz, nothing, then I tried then closest lower freq on the table, 16MHz, it works great at 9600 to 38400 baud, 4 times in a row on each of the three baud rates, it failed at 57600, and thats is not a valid pair on the table! Then I tried at the closest higher freq, 22.1184MHz, and it works every time from 9600 to 57600, 4 times in a row on each of the four freq steps!I did figure out a intermediate workaround, solder a 30pF to 130pF cap ACROSS the crystal (not to ground, this is not normal cap position) allows a successful erase/flash/verify, but does not run UNTIL I remove the added cap. The 20MHz crystal changes to 48MHz with the 130pF cap and 61MHz with the 30pF cap, these are way out of 24MHz the Atmel DS says to run, but it works, but really not the correct way.So I need to find out if Flip is able to program at lower baud rates, or find another program that will (and hopefully run after a reset), Any suggestions?TIA!

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 25, 2021, 01:29:59 am
content: Quote from: --Oz-- on June 24, 2021, 11:20:28 pmThat sounds like progress...In TSim51 the tick box called BLJB refers to theBoot Loader Jump BitDocs says thisWhen the target has BLJB=Y, then a Manual RST is needed to Enter Boot.When the target has BLJB=N, then a RST+PSEN Handshake is needed to Enter Boot.That would fit 'it all works but fails to run' symptoms. It should be possible to read a working part to check that bit status I think ? Or just try it both waysAddit: When testing I would suggest also removing / reapply of power, as I'm not sure which Atmel fuses need a power cycle to apply.Quote from: --Oz-- on June 24, 2021, 11:20:28 pmIf FLiP does not allow exact baud entry, you could try and old trick FTDI used to support - that swaps in a replacement baud value to a menu-fixed choice.http://www.ftdichip.com/Documents/AppNotes/AN_120_Aliasing_VCP_Baud_Rates.pdfI found an old batchisp.exe and tried command line entry of non std baud but it barfs on that. Not sure if you can patch the exe file where it says 9600 to allow 8300 ?

author: --Oz--
author_rank: Regular Contributor
timestamp: June 25, 2021, 11:34:16 pm
content: Thanks for the reply! I should be able to test these suggestions next week, will report back, thanks again!!!