Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

STM8S and SPI to Mini - Help Request


  • Please log in to reply
31 replies to this topic

#21 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 12 May 2012 - 05:56 PM

I am currently using the STM8S103F3P6 which I have mounted on a DIP adapter so that I can plug it into my breadboard. For final testing I use the STM8S003F3 which again I have in a DIP adapter. I use two different chips because the STM8S103F3P6 can be programmed 10,000 times whilst the STM8S003F3 can only be programmed 100 times.

I start out developing with the STM8S Discovery and then move to 103 when I need to move to breadboard. I have not had any problems with that Discovery board - it just plugs in and works.

I also have the ST-LINK/V2 for programming the chips when they are on breadboard. I found that no additional adapter is required if working on breadboard.

I have tried a couple of development environments, namely ST's own IDE and IAR. I am much preferring IAR and work with this all the time at the moment. You are restricted to 32 KBytes of program but I will be shocked if I get to a program that is that large. The IAR environment keeps surprising me - I found out today you can display the register values when at a breakpoint - useful.

I have also been using the STD Peripheral Library released by ST as the method of accessing the functions on the chip. I am doing this as I find they make the programs I am writing a little less opaque. There is a price for that though, the programs are larger and slower. Larger because you have to compile and link in ST's libraries and slower because of the overhead of parameter checking and function calls. I deviate from this when working on an Interrupt Service Routine as I need these to be fast and so here I access the chips registers more directly - it's a compromise.

I have produced a couple of posts on the exploits so far - there's nothing ground breaking but hoping it will help:

Connecting to the STM8S003
Some first step to module development

if nothing else they will act as memory aids for myself.

I also have the STM32F4 Discovery board and that works well too. For that board I have the Atollic development environment. I have not used this much.

Hope this helps,
Mark


Well, Mark, don't be afraid (although in the past I was too). The number of cycles of programming is an "expectancy", and does not have any relation on the actual number of uploads. Moreover, it's rated at a relatively high temperature (on the specs is 85'C), and that's pessimistic. I'd bet you may reach even 1000 times and more!
We're using 100-cycles rated chips, and they're running, re-programmed, many many times...we haven't any failure of flash or eeprom for over 10 years.

I wonder why you have 32k of size limit with IAR. I'm using it too, but it's clearly limited to 8k. I'm pretty sure about it, because the demo app of the discovery is 8233 bytes, and the compiler spit me back a message like "size limit is 8192 bytes". I had to increase the compiler optimization, and the app fitted.
I'm using the IAR Kickstart, which is free.

The major problem for me is watching at the PC screen the C sources. Then, with a "Shakespearean doubt", I ask myself: "to believe, or not to believe, that we're in 2012 and such a language looks like a '70?"

I'll let you know...
Cheers
Biggest fault of Netduino? It runs by electricity.

#22 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 12 May 2012 - 06:04 PM

I wonder why you have 32k of size limit with IAR. I'm using it too, but it's clearly limited to 8k. ...
I'm using the IAR Kickstart, which is free.

I'm using the kickstart as well - I may very well be wrong on the limit. It was over a month ago I selected the tools and started using them.

The major problem for me is watching at the PC screen the C sources. Then, with a "Shakespearean doubt", I ask myself: "to believe, or not to believe, that we're in 2012 and such a language looks like a '70?"


It took me back a while when I started using C again. I was a serious C programmer for many years but this year is the first time I have used it for nearly a decade. It came as a bit of a shock.

Regards,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#23 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 12 May 2012 - 06:11 PM

Otherwise, you have SPI settings wrong (clock phase, polarity) Posted Image

It was the SPI settings - I now appear to have bidirectional comms between the STM8S and the Netduino Mini.

Phew!

Thanks to everyone for all the help,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#24 ByteMaster

ByteMaster

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 13 May 2012 - 05:13 PM

Make sure that you're using the proper "alternate function" that SPI_SS needs. This setting is usually set with the fuses in the third tab of the ST Visual Programmer.

Chris


Thanks Chris, this one costed me at least two hours :blink:

On the STMS8S103K3 (32 pin) all the fuses were set properly to have SPI work out of the box. If you are working with the STM8S103F3 (20 pin) you need to set AFR1 = Port A3 Alternative Function = SPI_NSS, Port D .....
Kevin D. Wolf
Windows Phone Development MVP
President Software Logistics, LLC
Tampa, FL

#25 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2012 - 05:19 PM

ByteMaster--now you have me curious, wondering what you're building :) :) Glad this is up and running for you now. If you need anything else, just holler...there's lots of experience and expertise in the community. Chris

#26 ByteMaster

ByteMaster

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 13 May 2012 - 08:53 PM

ByteMaster--now you have me curious, wondering what you're building :) :)

Glad this is up and running for you now. If you need anything else, just holler...there's lots of experience and expertise in the community.

Chris


Hi Chris - yeah, I wish I would have posted this question a while ago :unsure: I've learned a lot from just going through the forums and reviewing some of the beginnings of what's in the Wiki. As I get more into this I'll start adding some stuff that I've learned.

Well my master plan [insert evil laugh emoticon] is to build a Quad Copter off of the Netduino GO! platform. I started off with a standard netduino and it seemed like I'd be pushing it too hard for the update rates I was looking for. So next I started building some AVR based modules to hang off of the first generation Netduino. Needless to say once you guys introduced the GO! platform my plans did a 180 and started to fall in love with the STM chips and for a lack of a better term an "object-oriented" way of building embedded apps.

Anyway here's my current effort that my wife is getting jealous of all the attention I'm giving it as I'm trying to stumble through putting it together:
Posted Image

Top right is a a GPS module based upon the Wi2Wi chip, this one is getting close, I just need to finish up the SPI dance between the STM & GO! This also as a 256K serial EEPROM for logging location data.

Then a module for either an XBee or a RN-XV Wifi device using an STM8S100F3 to do the buffering and communications to GO! via SPI. Eventually my plan is to just get the SMD chip version of the RN-VX this.

Third down is an RTC module based on the PCF8523 chip...it looks sort of dead without any LEDs but the I2C stuff is working so I just need to tie it back to GO!

Finally the two boards not populated, the one on the top is a simple GPIO board with ADC, PWM, etc.. and the one on the bottom will be my IMU board with a Gyro, Compass/Accelerometer and pressure sensors as well as an EEPROM.

Then of course we have the beautiful LCD Touch Module from NWazet and a few button modules to help with the testing.

I'm on vacation this week so I hope to flush out the hardware and then get some real boards on order from Seeed. Once I do so and if anyone is interested, I'd love to get some help with coding some of this stuff up! I'm not really in a position to do manufacturing of this stuff but I'm certainly going to release these as Open H/W S/W as well as a few blog posts on what I've learned.

Then sometime this summer when the firmware is done, the plan is to build Windows Phone and Windows 8 apps to act as the flight controller. Back in my comfort zone B)

One thing I did find incredibly helpful on when testing this stuff was getting a few of these extenders from GHI, they work really good to tie into the signals to and from the GO! board.
Posted Image

http://www.ghielectr...log/product/273

Anyway, once I get a little further I'll look at adding some stuff on the Wiki.

-twb
  • Gutworks likes this
Kevin D. Wolf
Windows Phone Development MVP
President Software Logistics, LLC
Tampa, FL

#27 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 13 May 2012 - 09:55 PM

That looks great - especially the home-etched boards. That's just the sort of stuff I want to do - once I've finished with a non-Microcontroller project I'm in the middle of.

#28 ByteMaster

ByteMaster

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 13 May 2012 - 10:07 PM

That looks great - especially the home-etched boards. That's just the sort of stuff I want to do - once I've finished with a non-Microcontroller project I'm in the middle of.



Yup - it really is a lot of fun. Creating these boards and "plopping" the SMD parts on top of it isn't nearly as hard as it looks. A relatively cheap stereoscopic microscope and a somewhat steady hand is all you need. Definately give it a try!
Kevin D. Wolf
Windows Phone Development MVP
President Software Logistics, LLC
Tampa, FL

#29 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 May 2012 - 02:50 PM

Hi ByteMaster,

Well my master plan [insert evil laugh emoticon] is to build a Quad Copter off of the Netduino GO! platform.

Now that is _very_ cool. This is one of the kinds of hands-on projects that we were hoping to enable with the distributed architecture of Netduino Go.

Impressive! I can't wait to see your progress!

Do you need high data rates on any of these modules?

Chris

#30 ByteMaster

ByteMaster

    Advanced Member

  • Members
  • PipPipPip
  • 76 posts

Posted 14 May 2012 - 06:02 PM

Do you need high data rates on any of these modules?


Not sure on that yet, I suspect I'll go through a few propellers, but hopefully not a lot of fingers figuring that out. My plan is to do the time critical stuff on the STM chips and then send the processed data back to GO! to let it figure out where to hand if off to do the actual control. So I envision lots of really small packets via SPI, I ?think? that will be adequate.
Kevin D. Wolf
Windows Phone Development MVP
President Software Logistics, LLC
Tampa, FL

#31 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 16 May 2012 - 08:12 PM

For those who are interested I have written up the work, problems and solutions on my blog.

Hope you find this interesting,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#32 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 May 2012 - 09:19 PM

Not sure on that yet, I suspect I'll go through a few propellers, but hopefully not a lot of fingers figuring that out. My plan is to do the time critical stuff on the STM chips and then send the processed data back to GO! to let it figure out where to hand if off to do the actual control. So I envision lots of really small packets via SPI, I ?think? that will be adequate.

Sounds like a good plan. Unless you need megabits of SPI data transfer or lots of on-MCU processing, the STM8S chips are probably the best fit.

Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.