A question for NGW Linux users

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

Hi,

This question is mainly for Ben Nizette (hi friend :) thx for your attention) and any other NGW user who has flashed pmbus code from David Brownell.

I'm using avr-gcc-4.3.2 and typing Make using Makefile included with the sources, elf executable can not be linked complaining about section overlapping. The generated objetcts main.o, pmbus.o and usi_i2c_slave.o sum up to 9KB. Therefore I suppose that linker complains because these objects do not fit in 2KB flash space of Attiny24.

Moreover, size of elf pre-built binary included in David's package is 16KB, so I can't imagine how can this be flashed into 2KB Attiny24 flash. Stripping this binary I've achieved 2.5KB, yet too big.

I'm a newbe and I don't know where the problem comes from. Thank you.

Forgive me, admin (hce) for asking about this twice... but you moved my post and I think that it made my query confusing. So I've decided to explain my problem again more clearly in this new message. Please, note that this question is for NGW Linux users who have faced this before. Moreover, this code was posted in avr32linux mailing lists.

Have a nice day,
Ric

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

I actually just imported the source in to avrstudio on my windoze box and it came out fine. I haven't done much avr devel under Linux.

The prebuilt binary will actually fit (just), even the stripped version has content that won't end up inside the avr.

-S.

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

Thx man.

I've installed WinAVR, now I can compile and generate pmbus.elf (great news compared to yesterday).

Now I try to program that elf image with AVR Studio 4 and AVRISP mkII. Tools->program avr->auto connect. Then Erase device and program pmbus.elf.

Quote:
Getting isp parameter.. SD=0x06 .. OK
Validating ELF input file.. OK!
Reading FLASH input..OK!ELF flash input does not fit in device <- this sounds awful!!!
Setting mode and device parameters.. OK!
Entering programming mode.. OK!
Erasing device.. OK!
Programming FLASH .. OK!
Reading FLASH .. OK!
FLASH contents is equal to file.. OK
Leaving programming mode.. OK!

Then I reboot NGW100, install i2c-0 device, execute pmbus -s 0x35 and I gent disordered info:

Quote:
~ # ./pmbus_peek -s 0x35
PMBus slave on /dev/i2c-0, address 0x35

Inventory Data:
Manufacturer: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Model:

Revision:

PMBus revisions (0xff): part I, ver ?; part II, ver ?
Capabilities (0xff): PEC, SMBALERT#, ?speed?

Device can't QUERY for supported commands
Status ffff: vout, iout, vin, mfr, power_good#, fan, other, unknown, busy, off,
vout_overflow, iout_overflow, vin_underflow, temperature, comm/memory/logic, uns
pecified
MFR_SPECIFIC ff: mfr_status_7, mfr_status_6, mfr_status_5, mfr_status
_4, mfr_status_3, mfr_status_2, mfr_status_1, mfr_status_0
CML ff: invalid command, invalid data, PEC, memory fault, pr
ocessor fault, (reserved), other comm fault, other memory/logic fault

Attribute Values:

I have to admit that I don't understand last steps in attiny firmware wiki:

Quote:
You can also do it with ISP mode and avrdude.

* Your board serial number, up to 10 ASCII characters starting at the beginning of the EEPROM. Copy it from the sticker on the bottom of your NGW board; it's not the product name or the manufacture date code, and may be like "NGW01234".

* Two bytes of temperature calibration data, starting at the tenth byte. Start with the default offset, and update it based on the reported temperature. (Or leave it as all zeroes or all ones, to use a default and correct it later.)

But that should not be related to basic working of the software.

Thanks again man, have a nice day.
Ric

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

Interesting that it doens't fit... Is it compiled with -Os? Check the avrstudio project options. ISTR the default is -O2 which won't fit.

If you want a serial number programmed in then this should live in the first 10 bytes of eeprom. If you leave it blank then all should still be well, you just won't have a serial number. The next 2 bytes of eeprom, that is bytes 11 and 12 are temp calibration data. Without programming these correctly you will get dodgy temp data but as before, it shouldn't break anything.

I might get a newer set of compilers and try again shortly, hopefully it isn't a compiler issue.

-S.

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

Ey man thanks for your response.

Replacing i2c-atmeltwi driver with i2c-gpio solved the problem, even though my AVR Studio still complains about elf size.

I don't know if i2c-atmeltwi is buggy... ¿? I'll browse the web. I'm also going to meassure SCL frequency using both drivers to compare them.

Lastly, I'll try to program those first bytes with serial number and temperature data, but at this moment I have no idea. I think that AVRISP mkII can't read/write memory addresses, and my AVR JTAG mkII debugger can NOT even flash device. Maybe the problem with JTAG is:

Quote:
However, *DO NOT* try to do this using the debugger (DebugWire) unless you first remove the zero ohm resistor connecting the ATtiny24 reset line to the AVR32 reset line!! (It's labeled "0", and sits between the ATtiny24 and DataFlash chips.) DebugWire won't work, because of a capacitor on that line.

Have a nice day and thank you for your time.
Ric

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

Okey, I've just read that i2c-atmeltwi is buggy and not recommended (I'm using kernel 2.6.23.atmel.5, I wonder if it has been already fixed or not; anyway, using gpio bitbanging is OK). I feel sorry for having stolen you some precious minutes for this "silly" problem.

The second question remains... I don't know how can I program those first bytes from AVR Studio. I suppose that my AVRISP mkII can't do that, and I also suppose that my AVR JTAG ICE mkII can't work because of that 0ohm resistor (I'm almost sure that I'm connecting it correctly to ISP connector following AVR JTAG ICE mkII user guide). But I still have not tested it.

Thanks again,
Ric

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

Okey, JTAG ICE mkII works correctly in both modes DebugWire & ISP after removing that 0ohm resistor.

Now the problem, again, is image size. AVR Studio checks that it does not fit flash and aborts debugging. At least, I've checked with smaller projects (smaller executable images) that JTAG ICE mkII can be used to program EEPROM bytes in AVR Studio 4 memory window. Therefore, I'm ready to face again this issue (calibrating ATtiny24 temperature and serial number) if someday this size problem dissapears (the only version of WinAVR available in sourceforge at this moment is GCC4.3.0).

Have a nice day,
Ric

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

You may need to be very careful with the compiler options you use. See what the Makefile in that SHAR file uses, and make sure you feed the same ones through AVR studio. Some versions of AVR-GCC are a bit buggy too. But if you can't get the pre-built ELF image to load, you're doing something wrong. The "size" command should report that the text size is under 2K:

   text	   data	    bss	    dec	    hex	filename
   2032	     15	     62	   2109	    83d	pmbus_slave.elf

That "data" size includes EEPROM and FUSE bytes, so it doesn't count. BSS is SRAM. Only TEXT goes into flash.