free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Rickey's World :: Discussion Forums :: Discuss and Learn :: 8051 Discussion Forum
 
<< Previous thread | Next thread >>
MCU interface to flash via SPI
Moderators: Ajay Bhargav, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph, ExperimenterUK, DavesGarage
Author Post
GVashist
Sun Jun 14 2009, 01:46PM
 User Offline
Registered Member #17945
Joined: Sat Apr 25 2009, 09:32PM

Posts: 12
Thanked 1 time in 1 posts
hey

I am currently working on a project involving getting data from a source, coverting it to digital via ADC, and sending it to a flash via an SPI interface. also, the MCU sleeps for a set amount of time, wakes up, does the above mentioned job and goes back to sleep
i wrote some part of the code anf it works fine until the SPI part. it sleeps, wakes up, fetches data to adc, converts, writes onto a UART(debugging feature as of now). but its also supposed to write to the SPI.
i havent programmed the flash yet(no init of flash done)
but i have done the SPI bit until it reaches the interface. now, i must be able to see the SCLK right? i dont. i really cant figure out wats wrong.
i have attached the files. i really want some help fast.
the datasheets can be found here.
https://www.silabs.com/Support%20Documents/TechnicalDocs/C8051F93x-92x.pdf
http://www.winbond.com/NR/rdonlyres/93A5FE5A-EEF2-417B-87A8-CB8144F6120D/0/W25X10A_W25X20A_W25X40A_W25X80A.pdf
i will be online so any questions, please ask me.
also, any suggestions will help, i can try it out right away and let u know

thank you
adc_spi_sleep_withled.rar

Back to top

Ajay Bhargav
Tue Jun 16 2009, 05:32AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
are you able to write in SPI memory without going power down?

Have you selected CKPHA and CPOL bits correctly?

your code is big enough and takes time to read & understand so we will drill down to the problem with your observations on code. ok?

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

Ajay Bhargav
Tue Jun 16 2009, 05:34AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
[Topic moved to 8051 Discussion forum]

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

Tech350
Tue Jun 16 2009, 05:59AM
 User Offline
Registered Member #19049
Joined: Thu Jun 04 2009, 03:07AM

Posts: 29
Thanked 0 times in 0 posts
Hi,

I'm working on a similar project. I'm using a SD card and using SPI to communicate. I have failed in even trying to initialize the SD. I want to intialize and format it in FAT16 or FAT32. If any advice or info please help me :-s

Thanks in advance.

In my case a program is something which always converts data into error messages!!
Back to top

GVashist
Tue Jun 16 2009, 08:08AM
 User Offline
Registered Member #17945
Joined: Sat Apr 25 2009, 09:32PM

Posts: 12
Thanked 1 time in 1 posts
are you able to write in SPI memory without going power down?

i dont think so. i checked the ports 0.0 to 0.3. at 0.0 i'm supposed to get the clock - no clock. and the other pins are at their original voltages.

about the ckpha and ckpol bits, let me check that up. thanks for the advice.

@Tech350: this is the1st time i'm using spi too. there are a bunch of links from spansion and sst regarding spi for flash. hope they help.
Back to top

Tech350
Tue Jun 16 2009, 09:52PM
 User Offline
Registered Member #19049
Joined: Thu Jun 04 2009, 03:07AM

Posts: 29
Thanked 0 times in 0 posts
@GVashist - I'v used SPI for other applications like DAC before successfully but no luck with SD. Well if any info on basic initialization sequence would be helpful. Will update my progress and post if I have any improvement.

In my case a program is something which always converts data into error messages!!
Back to top

Ajay Bhargav
Thu Jun 18 2009, 06:58AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
I have used RD2 in both SPI slave and master configuration, and all worked great.

@Tech350, post your program in a separate thread, i will look for the problem.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

GVashist
Thu Jun 18 2009, 08:52AM
 User Offline
Registered Member #17945
Joined: Sat Apr 25 2009, 09:32PM

Posts: 12
Thanked 1 time in 1 posts
hey. i got rid of the interrupt and instead took to polling. it works great on my development kit.
but when i put it on the custom board i built, it just goes haywire.
it works intermittently, and sometimes doesnt work at all. have i missed something.
i have attached the new files and the schematic of the new board
mcu_schematic_rev02_03252009.pdf
Back to top

GVashist
Thu Jun 18 2009, 08:53AM
 User Offline
Registered Member #17945
Joined: Sat Apr 25 2009, 09:32PM

Posts: 12
Thanked 1 time in 1 posts
here is the new code.

regards
adc_sleep_spi.rar
Back to top

 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems