Bug, One Line Code Issue *Solved (kinda)

SpokePOV kit for bikes

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
bkingsley22
 
Posts: 3
Joined: Sat May 14, 2011 7:30 pm

Bug, One Line Code Issue *Solved (kinda)

Post by bkingsley22 »

Just built three Spoke POV blades and they look awesome !!!

However, I have noticed a weird issue. From some research through the forums it appears to be a bug in the Firmware code. Something to do with the mirroring effect and how a row of lights on one side stay lit. Anyways, I am surprised I have been able to achieve this much. I know how to write some code, enough to change the small defect. Although, to update the firmware I see references to AVR programming and compiling. I have very basic knowledge in even this and with that I have no clue.

Could I beg of someone to explain a step guide to solving this code issue? Thank you so much, I am grateful for any advice.
Last edited by bkingsley22 on Thu May 19, 2011 6:38 pm, edited 2 times in total.

robinver
 
Posts: 1
Joined: Sun May 15, 2011 2:27 pm

Re: Bug, One Line Code Issue

Post by robinver »

same issue here... anyone that can help ?

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Bug, One Line Code Issue

Post by adafruit_support_bill »

Have you looked at the AVR tutorials?

bkingsley22
 
Posts: 3
Joined: Sat May 14, 2011 7:30 pm

Re: Bug, One Line Code Issue

Post by bkingsley22 »

Hi Arduwino, I am an educator by profession and so I definitely respect your logic. I see that your posts are much less of an easy answer and more of a guiding suggestion. This way, we are led to the answer by our own admission and truly comprehend the content, rather than just follow a given answer.

So, I have continued to research this problem as much as I can. Again, I have extremely basic knowledge in any of this. However, as far as I can tell, to fix this bug I must...

1. -Install AVRDUDE in order to program/flash the AVR microcontroller on each of the Spoke POVs. (Assumes use of USBtiny to program to SpokePOV.)

2. - Find the "main.c" file from the Spoke POV firmware source files. Edit the line of code appropriately as follows:

Line 102 of main.c needs to be changed from
Code:

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


to
Code:

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


3.- Locate the newly edited and saved "main.c" file, along with "makefile" and compile.

4. -Upload the new resulting ".hex" file to each SpokePOV.

Could someone please let me know if I am missing anything. I do not want to update the firmware on the chip and wind up "bricking" it from some dumb oversight. Essentially, am I missing any steps ? All I do is update the "main.c" file. But then what about the other files in the original Firmware folder? All I use to create a new .hex is the main.c and makefile ? Then, all I update to the chip via AVRDUDE is the .hex file ? Or are there other files, procedures I am missing? I saw references to all kinds of adjustment like "fuses", etc.

My head was already swimming from all of this new terminology and language. Any insight is greatly welcomed so that I do not wind up totally screwing up my boards from trying to edit this code. Thanks all.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Bug, One Line Code Issue

Post by adafruit_support_bill »

I come from a family of educators. I guess it must be in the blood. :)

It sounds like you have done your homework and identified the right steps. The only source file you need to modify is Main.c. The other .C and .H files will be automatically included in the build at compile time.

You do not need (or want) to change any fuse settings. The correct fuse settings are already programmed for the SpokePOV. Altering fuses is the most common way to 'brick' a chip and should only be attempted once you have a good understanding of what they do.

bkingsley22
 
Posts: 3
Joined: Sat May 14, 2011 7:30 pm

Re: Bug, One Line Code Issue

Post by bkingsley22 »

*Update:

Thank you for the inspiration. After many hours (insert much frustration here) I was finally able to flash the new ".hex" file to the attiny2313. I checked the mirroring option and what do you know...the problem has been solved! What an accomplishment for my amateur abilities. However, as one door closes another opens and now I have a new problem.

None of the buttons are responding. I try battery resets and nothing changes. So, somehow this function got messed even though the only change I made to the "main.c" was the slight addition of that line of code. I do not know enough about this to begin where to identify and fix this new issue.

As an alternative, I found the Jonathan Karpick "blinky" version of the firmware. (Yes, this still has the bug in the code.) I did the exact same steps to change the "main.c" file, compile it, and flash to the boards. For some reason this works as it should, the LED bug is fixed and the buttons remain functional. So, I am at happy to have that !

I would still like to know, for educational purposes, how to diagnose and solve the issue with my first attempt using the original firmware "main.c" file. I am fascinated and intrigued. As inspiration to others....just persist, it can be done if you so desire.

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

Return to “SpokePOV (discontinued)”