Author Topic: Need help with SPI on AVR  (Read 13921 times)

0 Members and 1 Guest are viewing this topic.

Offline MrAureliusRTopic starter

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Need help with SPI on AVR
« Reply #25 on: September 04, 2013, 03:28:06 am »
The MCU definitely has power.

Just tried the original program, with the SPI byte, and it's working like a charm with the AVRISP unplugged.

About a month ago I accidentally put 120VAC into my breadboard, which had the AVRISP attached at the time. It seemed to be fine afterwards, but I've started to notice little quirks like this. I guess it's time to replace it... I also have a USBASP but I'm not a huge fan of it. I'd rather get another AVRISP mkII, or even a step up, like the AVR Dragon I think it's called?
--------------------------------------
Canadian hacker
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 12650
  • Country: nz
Re: Need help with SPI on AVR
« Reply #26 on: September 04, 2013, 03:33:57 am »
About a month ago I accidentally put 120VAC into my breadboard, which had the AVRISP attached at the time. It seemed to be fine afterwards, but I've started to notice little quirks like this. I guess it's time to replace it... I also have a USBASP but I'm not a huge fan of it. I'd rather get another AVRISP mkII, or even a step up, like the AVR Dragon I think it's called?

It could also be the breadboard itself. Even a good breadboards can give connection problems.
Did the 120V short out ? it may have coated parts of some holes internally with carbon and be causing bad connections. Or the heat may have removed the "spring"ness of the metal inside the holes
« Last Edit: September 04, 2013, 03:36:37 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: Need help with SPI on AVR
« Reply #27 on: September 04, 2013, 03:36:49 am »
Don't forget the very likely possibility that the breadboard has always been a giant turd, like mine...
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline MrAureliusRTopic starter

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Need help with SPI on AVR
« Reply #28 on: September 04, 2013, 03:52:59 am »
It was a different breadboard that took the beating... and I'm using my smallest breadboard, but it's also the best quality one of the three I have. My huge one is the next best, so maybe I'll switch over to that, but it's covered in Z80 et alii...

By the way, here's a picture of my sweet, sweet, success!  :-/O



For some reason, the output of the slave is very weak. Here it appears as a really low duty cycle, but on the scope it looks... well.. a bit wonky. Very weak, all logic 1's, and they're at different levels, they look capacitatively loaded (is capacitatively a word?)

EDIT: Duh, it's ghosting the clock line.  :palm:
« Last Edit: September 04, 2013, 05:43:30 am by MrAureliusR »
--------------------------------------
Canadian hacker
 

Offline MrAureliusRTopic starter

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Need help with SPI on AVR
« Reply #29 on: September 04, 2013, 05:27:53 am »


I DID IT!!

I successfully wrote to my EEPROM. I know this seems like a small thing but after all the hell I've gone through trying to get it working, this is like seeing the light! No arduino, no raspberry pi, just a breadboard, some wires, and a couple chips! Man I'm proud of myself.
--------------------------------------
Canadian hacker
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 12650
  • Country: nz
Re: Need help with SPI on AVR
« Reply #30 on: September 04, 2013, 06:55:09 am »
I DID IT!!

I successfully wrote to my EEPROM. I know this seems like a small thing but after all the hell I've gone through trying to get it working, this is like seeing the light! No arduino, no raspberry pi, just a breadboard, some wires, and a couple chips! Man I'm proud of myself.
Well done.  You're now an electronic engineering, please don't use your new powers for evil.   :-+


I see you have a 150ms delay in your write loop. Your eeprom thanks you for that decision.
Without that delay it would wear out the eeprom in no time at all.

Better not leave it running though, even 150ms is still 6.66 writes per second.   
  100,000 writes / 6.66 = 15151 seconds = 252 minutes = 4 hours until eeprom dead.
« Last Edit: September 04, 2013, 07:08:06 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline MrAureliusRTopic starter

  • Supporter
  • ****
  • Posts: 373
  • Country: ca
Re: Need help with SPI on AVR
« Reply #31 on: September 04, 2013, 07:13:58 am »
I wouldn't say I'm an EE yet. Wait till I have my diploma in 2-3 yrs.

Yeah I kept that in mind when running the program. I ran power to the ATmega for a few seconds at a time.

Next step is to write only when a button is pressed. I really need to learn how to use 7-segment displays. I want to create a PDP like switching panel for entering data into the Z80/EEPROM/RAM...

Typed using Hacker's Keyboard for Android

« Last Edit: September 04, 2013, 07:15:36 am by MrAureliusR »
--------------------------------------
Canadian hacker
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5344
  • Country: ro
  • .
Re: Need help with SPI on AVR
« Reply #32 on: September 04, 2013, 02:09:09 pm »
Have a look at this page, scroll down and it explains led 7segment displays and other things :

http://www.mikroe.com/chapters/view/17/chapter-4-examples/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->