Found & fixed a bug regarding mirror mode

SpokePOV kit for bikes

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
surfsmurf
 
Posts: 12
Joined: Mon Jan 14, 2008 3:24 pm

Found & fixed a bug regarding mirror mode

Post by surfsmurf »

The problem is that on the back side the first line of pixels is wrong. I checked the firmware code (while looking into syncing several SpokePOVs) and found the bug:

Line 102 of main.c needs to be changed from

Code: Select all

spieeprom_read_into_leds(anim_eeprom_offset + (1024UL-eepromaddr), BACK);
to

Code: Select all

spieeprom_read_into_leds(anim_eeprom_offset + (1024UL-eepromaddr) - 4, BACK);
A classic one-off bug :wink:

surfsmurf
 
Posts: 12
Joined: Mon Jan 14, 2008 3:24 pm

Post by surfsmurf »

And btw, any idea why the delay_ms function stopped working when I compile the firmware, just like it did for the guy who did the blink led mod?

Might it be a gcc3 vc gcc4 issue, I am using gcc4.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

yeah its probably a compiler issue...

kayrock66
 
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

Wrong fuse setting?

Post by kayrock66 »

I'm wondering if you perhaps have the oscillator fuses wrong so you're running at 1MHz instead of the 8MHz the firmware assumes.

kayrock66
 
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

Post by kayrock66 »

minor tweak suggestion- The code would be more robust for reuse if it didn't depend on a non-default fuse setting to work right. You could add a line of code that sets the master clock up to 8MHz regardless of the fuse setting.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

mm, you cant have SPI at 8mhz if the chip is running at less than that

kayrock66
 
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

Post by kayrock66 »

Don't get what you mean. Are you talking about for programming the flash? Or do you mean the use of the SPI port for POV code operations?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

both! :)

kayrock66
 
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

Post by kayrock66 »

Its my understanding, which of course I could be mistaken :oops: , that the CKDIV8 fuse setting sets the initial value of the CLKPR register. Manually setting this register under program control establishs chip operation in every way the same as having its value initialized by the setting of the CKDIV8 fuse.

The benefit of setting the register under program control of course being that the default CKDIV8 fuse setting can be left as is.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

clkpr can divide down, but i am pretty sure you cant undivide

kayrock66
 
Posts: 150
Joined: Tue Oct 09, 2007 1:06 am

Post by kayrock66 »

The internal oscillator runs at a 8MHz regardless of operating voltage. The problem the fuse settable divider ratio solves is allowing the rest of the chip to run at 1MHz for the times that the chip is powered up at a voltage too low to reliably run at 8MHz.

So they ship the parts with the low speed fuse setting, and then you can turn off the clock division by fuse setting or programmatically. The fuse just sets the reset state of that register. It sets it to divide by 8.

Locked
Please be positive and constructive with your questions and comments.

Return to “SpokePOV (discontinued)”