Embedded Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsComputer HardwareEmbedded Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 17th, 2009, 08:50 AM
navs navs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 navs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 35 sec
Reputation Power: 0
Programing a development board in c to generate 101010.........on MOSI pin of spi

i have a dev board which has two spi interfaces,i want to generate a clock pulse on spi2 MOSI pin using c.i am new to enbedded programing and so dont know the basics of bit level programing.the board i am using is stm32 p103 from olimex based on arm cortex m3.


i have downloaded the spi driver from stm site.but i am unable to understand any part of the program as its too complex.any help???

Reply With Quote
  #2  
Old November 17th, 2009, 10:39 AM
clifford's Avatar
clifford clifford is offline
Contributing User
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: UK
Posts: 4,808 clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level)clifford User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 42 m 37 sec
Reputation Power: 1800
Quote:
Originally Posted by navs
i want to generate a clock pulse on spi2 MOSI pin

Why? If you want to do that, then you would configure the PIN as a GPIO rather than SPI and simply toggle it. In SPI you would place the data to be clocked out in the SPI data register, and start the SPI clock. This will generate the necessary 8 active transitions on the CLK while toggling teh data bits onto MOSI - you don't put "clock pulses" onto MOSI, that is for data.

I am speaking in general terms, I do not know the exact details of the STM32's SPI implementation, and am not about to wade through the reference manual for you (http://www.st.com/mcu/familiesdocs-...amming%20Manual). However SPI is a very simple interface, so there are few variations on that.

Clifford

Reply With Quote
  #3  
Old November 17th, 2009, 11:26 AM
mike65535's Avatar
mike65535 mike65535 is offline
um, Hello?
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2004
Location: FN23fc
Posts: 719 mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level)mike65535 User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 42 m 56 sec
Reputation Power: 159
Perhaps you are trying to see something (anything!) come out the port?

If so...

Sometimes a CPU automatically generates the necessary outputs (clock and data for example) simply by writing a value to a specific register. Is that the case with your device?

If so, you could write a loop to write a value to the register over and over and then scope the pin(s) to see if anything sensible is coming out.

If not...
what are you trying to do, then?
__________________
"America's abundance was created not by public sacrifices to "the common good," but by the productive genius
of free men who pursued their own personal interests and the making of their own private fortunes. They did not
starve the people to pay for America's industrialization. They gave the people better jobs, higher wages and
cheaper goods with every new machine they invented, with every scientific discovery or technological advance --
and thus the whole country was moving forward and profiting, not suffering, every step of the way."
--Ayn Rand

Reply With Quote
  #4  
Old November 17th, 2009, 12:40 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 3,398 jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 48 m 17 sec
Reputation Power: 886
This thread should be moved to the Embedded Programming forum.
__________________
My worst nightmare was a pointless infinite loop.
Work in progress; don't poke the curmudgeon!
http://www.odonahue.com/

Reply With Quote
  #5  
Old November 17th, 2009, 12:40 PM
navs navs is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 navs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 35 sec
Reputation Power: 0
well my actual project is to interface a LCD display onto the board using spi interface.but i dont know to what extent the ready made driver code will automate the work for me.also i dont exactly know how to write c code to write binary data to a register.(is it possible to address a register in c directly).even if i could i dont know how to write a complex program like that.so i thought first i would check if i am able to send data to spi pin and if i am successful, then to go to the next step...

Reply With Quote
  #6  
Old November 17th, 2009, 12:46 PM
jwdonahue's Avatar
jwdonahue jwdonahue is offline
Bellevue WA, USA
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 3,398 jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level)jwdonahue User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 48 m 17 sec
Reputation Power: 886
Well you seem to be in over your head. It's a good place to learn to swim

Do not hook that LCD display up to your SPI interface yet. First you need to learn how to develop and test on an embedded system. Have you got a good scope handy?

I have requested this thread be moved to the Embedded Programming forum btw.

Reply With Quote
Reply

Viewing: Dev Shed ForumsComputer HardwareEmbedded Programming > Programing a development board in c to generate 101010.........on MOSI pin of spi

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap