Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Atmel AVR/Bascom as ISP
Goto page 1, 2  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Fri Apr 13, 2018 10:48 am    Post subject: Atmel AVR/Bascom as ISP Reply with quote

Hi All,

Background:
Several years ago I designed a small system that went into production (More than 1000 units sold already) and I've now got the budget for an update. The goal of the project is "Smaller, Cheaper, Faster".
Smaller is no problems, I'm going over to SMD for most of the components and the pneumatic system will also be redesigned.
Faster is also no problems, I've got a new design for the pneumatic system that has 50% higher flowrate.
Cheaper is also not too bad, the costs for the PCB/components will be about 35% less. But this is a drop in the ocean as the manual programming/testing costs a lot more than the electronics!

Idea:
Currently during production, the PCB is plugged into a gang programmer and the CPU programmed. Afterwards the PCB is installed in test system (including attaching 20 cables) and every input/output is checked manually (Host processor loops through each Input/Output Displaying/Setting the signal and the operator checks that the status is correct).

What I want to do is design a test frame that can program the host CPU then run a full set of tests automatically, without any user intervention. The testing part shouldn't be too hard, the only area where I see a problem, is the programming of the AVR per ISP.

Short version:
Has anyone written a ISP in Bascom? That can read the Fuse settings from a SD Card, write them to the "Slave AVR", read a binary image from the SD Card and write it the the "Slaves" flash with verify?

Regards
Ian Dobson

(BASCOM-AVR version : 2.0.8.1 )

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Apr 13, 2018 11:58 am    Post subject: Reply with quote

You can also make chip data and send it to atmel and they can program it for you. especial if you buy in big qty

I also recently made a special test board for a pcb. It is simple : use special test pins with a coil and connect with opto or whatever and load a special test program. when your board has a led you can light it when all is ok. it will improve test quality and time.
the only problem is to get the boards properly centered. So you need to have some holes and guides.

I must have some programming code somewhere. i once planned a portable programmer with sd-card but it never wend into production. At the moment i have no time to retrieve it from backup but
if you use 1 chip it is relatively simple protocol. and there are others with similar projects.
if you can not get it you can contact me at support so i can see what i can do.

_________________
Mark
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Fri Apr 13, 2018 3:19 pm    Post subject: Reply with quote

Hi Mark,

Thanks for the offer, I'll sit down this Weekend and see what I can do.

I've read the atmel specs. and the ISP protocol doesn't look too hard.

I've already ordered some "Pogo pins" for my test board, I just need to see how I can make the test System Operator safe (2 left Hands and nothing in between).

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Fri Apr 13, 2018 8:20 pm    Post subject: Reply with quote

@i.dobson hello and thanks for the AVR Timer Very Happy

..about ISP programmer made in the Bascom we have in Poland guy and device you can see under following LINK

This guy share codes for some devices but for this one you get only HEX..maybe He wait for you to offer Very Happy

If you need any translation from polish technique language I can help. Offcourse this guy speak english also Wink
I know from the trusted source that code it's written in Bascom Wink
Back to top
View user's profile Visit poster's website
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Fri Apr 13, 2018 9:03 pm    Post subject: Reply with quote

I'm not sure if this would be helpful or not:

One of the AVRFreaks Forum members, Alan, has a stand-alone programmer.
It does ISP and PDI (Xmega) programming.
It is about the size of a credit card, I believe.

One loads it with the program and the fuse settings, connects it to the target, push a button, and away it goes, doing its thing.

I think it might hold several programs in its memory, but you would have to read the user manual to see how one selects which program it loads into the chip.
Perhaps you could first load your hardware test program, and if it all checks out then load the final program and set the lock bit fuses.

You'll have to read through the Thread, I believe Alan is now up to Ver 4 of his little programmer.

I'm not sure if you can see photos on the Thread if you do not create a log in account.

The Thread describing it is here:
https://www.avrfreaks.net/forum/wts-standalone-pdiisp-auto-programmers

It is under the "Marketplace" sub-forum, Thread title: WTS: Standalone PDI/ISP Auto Programmers.

JC
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sat Apr 14, 2018 5:55 am    Post subject: Reply with quote

Hi,

Thanks for all the tips. I'd rather design my own as I want to combine a programmer with an I/O test System.

I couldn't sleep last night so I sat down and programmed a bit:-

Code:

Entering programming mode
Send AC 53 bytes, and got 53 FF
Program mode active
Getting Signature
Signature Bytes 001E9404
Getting Lock bits
Lock bits 11111111
Getting fuse bits
Fuse bits 11011100
Getting fuse bits High
Fuse bits High 11011000
Getting fuse bits Extended
Fuse bits Extended 11111001
Writing 130 to EEPROM address 66
Read 130 from EEPROM address 66
 


So enter/Exit proagram mode, Read all Fuse bits (High, Extended, Lock), Read/Write EEPROM already works.

I still need to write code for the Flash/Fuse writing but with only afew hours work I've made really good Progress.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Sat Apr 14, 2018 6:22 am    Post subject: Reply with quote

i.dobson wrote:
I couldn't sleep last night
Think Hmmm I know it from somewhere
My previous post was not an advertisement. It was only point that ISP programmer /from SD Card/ can be made Wink
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sat Apr 14, 2018 6:29 am    Post subject: Reply with quote

Hi EDC,

No Problems, I didn't think that it was an ad.

Just seeing that someone else managed to do it, gave me the confidence to try myself.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sat Apr 14, 2018 10:24 am    Post subject: Reply with quote

Hi All,

This is easier than I though it would be.

Read Flash Byte/Erase Flash is also working. Writing a Flash page doesn't work (It always writes to page 0), but I'm getting really near to a solution.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Mon Apr 16, 2018 2:10 am    Post subject: Reply with quote

Hi Ian

for writing Flash pages, see the BASCOM Bootloader samples. The two subroutines are easy to use/understand. The only caution is with XMEGA E Series ... they use a different page Erase/Write process than that of the other uC.

E
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Mon Apr 16, 2018 7:53 am    Post subject: Reply with quote

Hi All,

Got writing a Flash page working. The Address is is in Words, with all the low bits in a page masked off.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Tue Apr 24, 2018 4:37 pm    Post subject: Reply with quote

Hi All,

Showed a simple demo to the guys in production today. This went very well, even though they've got new ideas for things I should implement.

Programming and verifying a 16Kb chip only takes about 30 seconds.
Testing 20 I/O's (It's just a simple Host Sets PIN, Slave sees pin change takes less than 2 seconds), so testing a complete PCB with ca. 100 I/O's should take too long.


All I need to do is finish the Slave PCB design, define the test points, design a "bed of nails" test PCB (using Pogo pins for contacts) and write a PC application that generates a report (PDF/Printout) for the tested board.

Maybe when I get the time to clean up the ISP code I'll post a copy here.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Tue Apr 24, 2018 9:58 pm    Post subject: Reply with quote

Hi Ian,

are you using ISP or PDI or TPI?

E
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Wed Apr 25, 2018 4:41 am    Post subject: Reply with quote

Hi,

Just ISP, the host CPU uses Software SPI to communicate/program the slave.

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sun May 06, 2018 8:08 am    Post subject: Reply with quote

Hi,

Started playing with writing the fuse bits. I can write but I think I've misunderstood the documentation. After writing the slave CPU refuses to enter programming mode.

The documentation is a bit confusing for me:

1) I can read the fuse bits (for example Fuse Extended value = FF)
2) Bit 1,2,3 are 1 so they're unprogrammed
3) What I don't understand is should I write 0 or 1 to the 3 bits (To not Change them).

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum