The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Computer Hardware
> Embedded Programming
|
Programing a development board in c to generate 101010.........on MOSI pin of spi
Discuss Programing a development board in c to generate 101010.........on MOSI pin of spi in the Embedded Programming forum on Dev Shed. Programing a development board in c to generate 101010.........on MOSI pin of spi Embedded Programming forum discussing topics related to defining systems, selecting hardware and software components, the building of systems, and the integation of hardware and firmware designs.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 17th, 2009, 08:50 AM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 5
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???
|

November 17th, 2009, 10:39 AM
|
 |
Contributing User
|
|
Join Date: Aug 2003
Location: UK
|
|
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
|

November 17th, 2009, 11:26 AM
|
 |
um, Hello?
|
|
Join Date: Nov 2004
Location: FN23fc
|
|
|
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
|

November 17th, 2009, 12:40 PM
|
 |
Bellevue WA, USA
|
|
Join Date: May 2004
Location: Bellevue Washington, USA
|
|
__________________
My worst nightmare was a pointless infinite loop.
Work in progress; don't poke the curmudgeon!
http://www.odonahue.com/
|

November 17th, 2009, 12:40 PM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 5
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...
|

November 17th, 2009, 12:46 PM
|
 |
Bellevue WA, USA
|
|
Join Date: May 2004
Location: Bellevue Washington, USA
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|