Write to EEPROM

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

Im working on a project which includes writing from PC to the µControllers (ATTiny861) EEPROM. I want to store some sort of settings that can be changed via my laptop and if I reboot my µController the last settings will be loaded.

I want to use the usb on my computer and the contact on the PCB is ISP but I guess the cable can be redone to fit.

I've done this via MatLab but that was 2years ago, back at the univ. :)
But the thing is I want to use a program which dosent need a expensive license(freeware) and I also need to make a GUI so other ppl can use the software aswell to make changes in the EEPROM.

So if you got some sort of advice of software or a code which I can use pls answer. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

want to use the usb on my computer and the contact on the PCB is ISP but I guess the cable can be redone to fit.

If by "redone" you mean just changing connectors, then "no".

USB and ISP are quite different protocols, with different signals, and on different "levels".

In order to connect your AVR to the PC by USB you need one of these:

An AVR that has USB built in (the ATtiny861 does not have this)

An USB-to-Serial converter. Eg a separate chip from FTDI or similar, or a conversion "dongle" that you can buy from your nearest computer accessory dealer. You might also need to implement a voltage level conversion between the USB-to-Serial and the AVR.

A "soft USB implementation" in the AVR. This requires that the AVR runs at a high clock speed (close to 20 MHz IIRC), and there might not be much processing power left for the rest of the application.

And in neither of those cases you'd connect the signal to the ISP interface of the AVR.

If you want to connect to the ISP (and load the EEPROM through that) it can be done, but you need some "programming dongle". Exmples of such, that has USB connection on the PC side" are the Atmel AVRISP mkII, and the Atmel AVR Dragon.

If you want other users to be able to load the EEPROM then they need either such a programming dongle too, or you're back to one of the three requirements that I started off with. You then need to implement the USB firmware part in the AVR (different solutions depending on which of the three alternatives you choose) and an application on the PC side.

As I understand the your description the project is far from trivial. Especially if you already have the hardware part frozen.

What is your budget in time and money, available to this project?

What is your previous experience with AVRs?
With USB?
With serial (USART) comunication?

If I was to strt fresh, with your description I'd probably go with the Atmel AVR USBKey as hardware, and Dean Camera's LUFA software framework. Even with that the project is not trivial, unless you have previous experience with both the hardware and software.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

A "soft USB implementation" in the AVR. This requires that the AVR runs at a high clock speed (close to 20 MHz IIRC), and there might not be much processing power left for the rest of the application.

12MHz? See example circuit:

http://www.obdev.at/products/vus...

As well as mentioning V-USB I guess one should balance the odds by mentioning "LUFA" is a hardware USB AVR is to be used.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
If you want to connect to the ISP (and load the EEPROM through that) it can be done, but you need some "programming dongle". Exmples of such, that has USB connection on the PC side" are the Atmel AVRISP mkII, and the Atmel AVR Dragon.

If you want other users to be able to load the EEPROM then they need either such a programming dongle too, or you're back to one of the three requirements that I started off with. You then need to implement the USB firmware part in the AVR (different solutions depending on which of the three alternatives you choose) and an application on the PC side.

The dongle in my case is the AVR Dragon. :)
And the ones Im leaving behinde with my software are the owners of the Dragon.

JohanEkdahl wrote:

What is your previous experience with AVRs?
With USB?
With serial (USART) comunication?

I've done 2courses, the first was basic and asm only and the 2nd was more advanced and ended with a contest between robots that we made. :P
But I wouldnt say that Im good cause it was some time ago but I think Im lacking the expertice in hardware thou and that makes it harder then it has to be.

Didnt do anything with usb in neither of our classes but we have done some USART comunication, but as I said it was made with MatLab which I cant use this time. :/

I was hoping it was possible to use the usb cause its more common.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As Studio (and its collection of command line tools) can just program a .eep via the Dragon and ISP into the EEPROM of the AVR would that not deliver what you want?

Or do you want them to be able to change EEPROM in the AVR using nothing more than a USB cable?

But if they are the owners of the Dragon then they can surely just use that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
As Studio (and its collection of command line tools) can just program a .eep via the Dragon and ISP into the EEPROM of the AVR would that not deliver what you want?

Or do you want them to be able to change EEPROM in the AVR using nothing more than a USB cable?

But if they are the owners of the Dragon then they can surely just use that?

The project im working with is a prototype and it includes some new technology so they want to be able to change the settings as easy as possible. For example settings like how many times should a certine for-loop run and change some delays...
They lack the expertice in asm so the best thing would just to have a GUI where they can either typ values or have some sort of list to choose from.
If this is to time consuming then a simple cmd-software could work cause time is money. :P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So why not provide a UART interface to the running AVR and let them change things that way?

That then comes back to the question of how you connect an AVR UART to a PC. You could do it:

1) via MAX232 make direct connect to PC if it has RS232 DB9's

2) via an off-the-shelf USB-RS232 converter cable connect AVR UART to appear as "virtual comm port" in the PC

3) do the same but do it by putting an FTDI chip on the board with the AVR (most off the shelf cables just have an FTDI (or Prolific equivalent) chip in them)

4) use an AT90USB or other AVR with built in USB and run LUFA within it so that it appears as a virtual comm port to the PC under a USB CDC class device.

5) in a non-USB AVR run V-USB to simulate USB in software - again this can make the AVR look like a virtual comm port to the PC

In all cases the PC user just runs TeraTerm or RealTerm or Brays Terminal or whatever and it shows "menus" generated by the AVR (can be very pretty using ANSI/VT100 Escape sequences) that the user uses to adjust permanent settings in EEPROM.

Or, of course, you could just hand an HD44780 LCD and some buttons off the AVR and show menus/make settings without the intervention of a PC at all.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
2) via an off-the-shelf USB-RS232 converter cable connect AVR UART to appear as "virtual comm port" in the PC

That was my first idéa. Cause I've done that before and it is easy to set up on the µController (atleast what I remember from the time at the univ).

clawson wrote:
In all cases the PC user just runs TeraTerm or RealTerm or Brays Terminal or whatever and it shows "menus" generated by the AVR (can be very pretty using ANSI/VT100 Escape sequences) that the user uses to adjust permanent settings in EEPROM.

Brays looked really nice. Im going to take a close look on that software.