help me with that bootloader

For problems with Gamebuino itself, NOT your project

Re: help me with that bootloader

Postby treflip » Tue Jul 08, 2014 12:32 pm

Hey Albert,

I did like you said and ran a few sketches with my SD card on another setup to test it. It works well but I noticed in the code this comment:

// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.


I haven't investigated it thoroughly just yet, but figured I post it to you... pin 10 on the nano is BTN 2 an INPUT, so that might be where we are getting hung up. If you have some free time check it out. I will try later this week when I am available but that's as far as I could get this weekend (time, time, time....)
treflip
 
Posts: 83
Joined: Fri May 30, 2014 4:50 pm
Location: Florida

Re: help me with that bootloader

Postby rodot » Tue Jul 08, 2014 1:50 pm

What, the pinout on the nano is not the same ? Gosh... I think you just found the solution.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: help me with that bootloader

Postby jonnection » Tue Jul 08, 2014 10:09 pm

1) Arduino Nano and Arduino Uno have identical pinouts, EXCEPT Nano also has pins A6 and A7 (which are not real pins = cant be used for digital)

2) AVR ATMega328U chip pin PB2 = Gamebuino pin 14 = Arduino Uno board pin D10 = Arduino Nano board pin D10. No difference there with regards to CS function.

Image
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: help me with that bootloader

Postby albertinjo » Wed Jul 09, 2014 10:06 am

treflip wrote:I did like you said and ran a few sketches with my SD card on another setup to test it. It works well but I noticed in the code this comment:

// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.



Hello treflip, thanks for your reply.
I do not seem to understand what do you mean when you say " ran a few sketches with my SD card on another setup to test it".

I ran a few example sketches of the SDfat arduino library just to see if my SD card would work... and it worked, it works with the SDfat library, and I can also stream RAW audio files from it (as you can see on my gamebuino clone v1.0) using code from gamebuino wiki, only thing that does not work with my SD card is the gamebuino bootloader... and I have no explanation for that


jonnection wrote:1) Arduino Nano and Arduino Uno have identical pinouts, EXCEPT Nano also has pins A6 and A7 (which are not real pins = cant be used for digital)

2) AVR ATMega328U chip pin PB2 = Gamebuino pin 14 = Arduino Uno board pin D10 = Arduino Nano board pin D10. No difference there with regards to CS function.


Hi jonnection.
Indeed SD ENABLE = CHIP SELECT = CS =ARDUINO DIGITAL PIN 10 = D10 = SS = PB2 = PORTB.2
that means Arduino Uno pinout = Arduino Nano pinout = ATmega 328 pinout.....except ATmega 328 in DIP package is different than ATmega 328 in SMD package.
SMD ATmega 328 has 2 extra pins: ADC6 (A6) and ADC7 (A7), which can be used (as you said) only as analog inputs, in gamebuino schematics A6 and A7 are used for battery monitor and LDR (light dependent resistor (for automatic backlight))



About the chip select pin, on gamebuino CS (chip select or SD enable) is digital pin 10 = the hardware SS pin
So when I was trying out the SDfat examples I only had to set the chip select pin to 10 (if it was not set by default)

treflip wrote: pin 10 on the nano is BTN 2 an INPUT, so that might be where we are getting hung up. If you have some free time check it out.


???pin 10 is BTN2 on Nano....an INPUT....what do you mean, what button, only button on Arduino nano v3.0 is the RESET button, and it is used to reset the ATmega 328 by setting the RESET pin to GND.
If you meant gamebuino BTN2, it is on PIND.6 = arduino pin D6??
User avatar
albertinjo
 
Posts: 98
Joined: Wed Mar 26, 2014 2:26 pm

Re: help me with that bootloader

Postby treflip » Wed Jul 09, 2014 4:30 pm

albertinjo wrote:
  1. I do not seem to understand what do you mean when you say " ran a few sketches with my SD card on another setup to test it".
  2. So when I was trying out the SDfat examples I only had to set the chip select pin to 10 (if it was not set by default)
  3. ???pin 10 is BTN2 on Nano


1. I just meant that I tested my SD card on another arduino an it worked. It was easier to just use another mcu. I will pull the nano out and test it though to see if the BB is causing any errors writing/reading from the SD.
2. This is what I was concerned with at first, but
3. I see now that the physical pin is 14 not 10. I misread, in the sketch it said the ss pin is 10 on most arduino boards... wasn't sure if that was mcu or breakout board...

Since it looks like the wiring and software are mapped correctly I am leaning towards a propagation delay from the solder or BB wires causing the voltage to fall too quickly when the SD is activated. I don't really see this being a problem but did read about it again online somewhere so I will look at the Enable line tonight and see... I would like to compare it with the real GBO.

If anyone can probe the Enable line when they get theirs soon and post it then that would be a good reference.
treflip
 
Posts: 83
Joined: Fri May 30, 2014 4:50 pm
Location: Florida

Re: help me with that bootloader

Postby albertinjo » Fri Jul 11, 2014 9:44 am

Hello, thanks for your reply!

Yes, hardware connections with the SD card seem right. I do not know if the Breadboard connections are causing the trouble, maybe we should try soldering the SD card slot really close to the MCU on the Arduino breakout board.
User avatar
albertinjo
 
Posts: 98
Joined: Wed Mar 26, 2014 2:26 pm

Re: help me with that bootloader

Postby jonnection » Sat Jul 12, 2014 9:36 pm

A theory, that I can't test atm bc travelling.

The C input is tested immediately after the pin is set input and pull-up turned on. The capacitance of the breadboard prevents the pin hitting low immediately. That is why it is detected high. The capacitance of the trace on the gb circuitboard is maybe 5-10 times less, which greatly reduces the reaction time of the RC circuit. Just an idea.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: help me with that bootloader

Postby albertinjo » Wed Jul 23, 2014 10:14 am

The arduino detects the C button fine, the bootloader woks. There is a problem when it tries to flash LOAER.hex from SD card into the atmega 328 flash memory.
User avatar
albertinjo
 
Posts: 98
Joined: Wed Mar 26, 2014 2:26 pm

Re: help me with that bootloader

Postby jonnection » Thu Jul 24, 2014 9:48 am

Yes. I have been looking at the boot process through a logic analyzer and the bootloader is firing up correctly. I have now wired up my SD card in both my fakebuinos and i am having exactly the same problems as you.

I will share my findings soon.
User avatar
jonnection
 
Posts: 317
Joined: Sun May 04, 2014 8:21 pm

Re: help me with that bootloader

Postby treflip » Fri Jul 25, 2014 2:30 pm

Wanted to point to this post for solution- just need to confirm that games are working correctly (c doesn't back out to menu?)
treflip
 
Posts: 83
Joined: Fri May 30, 2014 4:50 pm
Location: Florida

Previous

Return to Installation & Troubleshooting

Who is online

Users browsing this forum: No registered users and 11 guests

cron