- Netduino Forums
- → hanzibal's Content
hanzibal's Content
There have been 386 items by hanzibal (Search limited from 01-July 24)
#51590 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 20 July 2013 - 12:39 AM
in
Netduino Mini
#52252 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 21 August 2013 - 07:57 AM
in
Netduino Mini
Wow!
#55448 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 17 January 2014 - 09:48 PM
in
Netduino Mini
Thanks baxter, I'll be sure to make a post when the driver's ready so that I got something to show you.
#51247 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 09 July 2013 - 07:38 AM
in
Netduino Mini
Have you measured the actual power consumption of the the [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]CC3000EM while it's fully running?[/color]
[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]I blew my [/color][color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]CC3000EM[/color][color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;] but a new [/color][color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]CC3000Boost arrived the other day [/color]
#55479 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 19 January 2014 - 10:15 AM
in
Netduino Mini

#51138 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 06 July 2013 - 03:00 AM
in
Netduino Mini
#50976 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 01 July 2013 - 07:55 AM
in
Netduino Mini
your radio or host board? I've flicked pwr_en high and low just fine, so maybe double check the wiring, maybe it's OK!
The radio, when trying to set the pwr_en input pin high by applying 3.3V to it, it seems to result in a short circuit.
#51131 Spark Core (TI CC3000) Porting for Super WiFI Mini?
Posted by
hanzibal
on 06 July 2013 - 12:25 AM
in
Netduino Mini
Great, those are some really good guide lines!
Admittedly, I haven't read your posts all that thoroughly yet (it's late over here) and surely there are things to be discussed but just to be clear that I was merely picturing a really basic (yet powerful and versatile) Wifi board for the common Netduino user to benefit from, not the next "Wifi Ûbershield" :-)
Primarily, I was thinking a Netduino specific board with header layout to match. Heck, the world is overwhelmed by Arduino stuff as it is, and it's not like we would be making a zillion unit thing with a technical height that could withstand more than a week on eBay given every little peace of additional hardware adds to overall costs in terms of time and consequently that of gold.
Basically making a few simple mods to that github board (undoubtedly nice work) in order to get a cheap, quick and dirty wifi board for the whole Netduino family of boards (not excluding the mini) with a managed driver to go as I know of which the ancient lady warrior being extremely resourceful when it comes to the latter of things :-)
@ziggurat29: Have you ever considered politics or have they perhaps already got to you? SMD.
#50619 Best Hobby Oscilloscope
Posted by
hanzibal
on 18 June 2013 - 06:40 PM
in
General Discussion
#56689 Automated Urban Garden
Posted by
hanzibal
on 07 March 2014 - 06:55 AM
in
Project Showcase
#56671 Automated Urban Garden
Posted by
hanzibal
on 06 March 2014 - 11:49 AM
in
Project Showcase
If you need more sensors, you could try interfacing the Parrot Flower Power:
http://www.parrot.com/flowerpower/en/
It would require a Bluetooth LE module and probably hacking their protocol. The flower power is a bit expensive but there's also the SensorTag from Texas which is not miles away (not a coinsidence):
http://www.ti.com/tool/cc2541dk-sensor
#56685 Automated Urban Garden
Posted by
hanzibal
on 06 March 2014 - 09:31 PM
in
Project Showcase
I got one, works perfecly with iOS devices but haven't got around getting a board for my Netduinos yet and turned out there's no BT LE drivers for my good old XP box (while as it is built into Win 7).
#56202 Networked music player using the mini
Posted by
hanzibal
on 19 February 2014 - 12:15 PM
in
Project Showcase
#57935 Networked music player using the mini
Posted by
hanzibal
on 04 May 2014 - 06:17 PM
in
Project Showcase
SCI_VOL is a h/w register of the vs1053b chip, so you need to write the value 0x2424 to the register. You do this using the serial command interface (hence the "SCI" prefix) over SPI.
// Write to an SCI register private void WriteRegister(byte address, ushort data, bool waitForDREQ = true) { wr_buff[0] = 2; // write command wr_buff[1] = address; // register wr_buff[2] = (byte)(data >> 8); // high byte wr_buff[3] = (byte)(data & 0xff); // low byte SelectCommand(); // select SCI if (waitForDREQ) AwaitDREQ(); // wait for dreq to go high spip.Write(wr_buff); } // example of setting volume WriteRegister(REG_SCI_VOL, 0x2424);
The code snippet above is taken from my source code (puplished earlier).
I would use a rotary encoder but if you want to use a potentiometer, you can set it up as a simple voltage divider GND - 3.3V and then read the voltage of the wiper using a Netduino analogue pin. You would then need to add software to continuously poll the analogue pin for any changes in voltage, executing the corresponding volume adjustments.
#58076 Networked music player using the mini
Posted by
hanzibal
on 12 May 2014 - 06:36 PM
in
Project Showcase
byte left_vol = 45; byte right_vol = 90; ushort vol = (left_vol << 8) + right_vol; WriteRegister(REG_SCI_VOL, vol);
#56344 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 24 February 2014 - 07:31 PM
in
Project Showcase
I'll figure something out - meanwhile you could try using only Bank 0 and see if you can get that working....The GetHashCode method can be overridden by a derived type. If GetHashCode is not overridden, hash codes for reference types are computed by calling the Object.GetHashCode method of the base class, which computes a hash code based on an object's reference; for more information, see RuntimeHelpers.GetHashCode. In other words, two objects for which the ReferenceEquals method returns true have identical hash codes...
#56343 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 24 February 2014 - 07:16 PM
in
Project Showcase
#56262 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 22 February 2014 - 01:30 AM
in
Project Showcase
for (uint Counter = 0; Counter < pinCount; ++Counter) Outs[Counter] = chip1.CreateOutputPort((MCP23S17.Pins)(1 << Counter), false);However, I really think you should be using the enums, then your code will be easier to read and will work even if I change the implementation. For example, you would have avoided the above bug :-) I see your expander board has the IRQ pins broken out after all which is great news but you might want to add that later when you got the basics working. Hope this helps!
#56236 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 20 February 2014 - 09:23 PM
in
Project Showcase
#56200 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 19 February 2014 - 10:54 AM
in
Project Showcase
This thread is about a software driver for a chip called MCP23S17 that provides 16 additional digital IO pins to a micro controller such as the one on your Netduino.

The MCP23S17 gives you 16 digital input, output and interrupt enabled pins over SPI. Up to eight chips can be combined on a single SPI bus to provide a maximum of 128 pins.
Background
I was originally looking to make a dual ] board (Arduino shield form factor) for this driver to be used with. As so often however, I haven't found the time to complete the board so I decided to release the driver code for others to use.
About the software
The driver class is actually quite powerful and has a lot of features. The whole interface somewhat mimics that of native Netduino GPIOs in how they are created and used. Full source code is attached to this post.
You can create individual pins (input, output, interrupt) and also buses to represent a collection of pins in parallell.
The buses are very powerful - for example, you can easily create a 4 pin bus to be used in controlling an LCD or something like that.
You can also read and write pins or buses in a so called "burst mode" - this will result in bit streams in either direction at about a tenth of the configured SPI speed.
The driver can also be used in a special "direct mode" where all the built-in code for thread safe pin management etc is bypassed in favor of more speed.
How to use it
Simply download the attached code file and add it to your project and start coding with it - these lines of code the only ones needed for an output port:
// create driver to use SPI bus #1 and Netduino pin 17 for chip selectvar chip = new MCP23S17(var io = new MCP23S17(SPI.SPI_module.SPI1, Pins.GPIO_PIN_17);// create a port for pin 1var outport = chip.CreateOutputPort(MCP23S17.Pins.GPIO_1);// drive pin 1 highoutport.Value = true;There are more examples abailable in posts ahead. There's currently no separate documentation for the software but it's easy to adopt and there are lots of intelli-comments in the code to help guide you through.
I'd love for you guys to try it out and then hear about your experiences!
Hardware
Obviously, you need one or more MCP23S17 chips as well. The chip is available in a breadboard friendly DIP28 package and breakout boards are available on eBay and other places.
You wire the chip just as you would any other SPI slave device - connect power, ground, miso, mosi, clock, chip select and optionally an additional pin to receive interrupts.
NOTE: This driver is for the SPI version of the chip, i.e. MCP23S17 and not the regular MCP23017 which uses I2C. I was planning on isolating the transport layer to support both but I will probably never get around doing that so if you're up for it...feel free!
Code revision history:
v1.1 - corrected a bug involved in cascading
v1.2 - added internal multi SPI mgr
V1.3 - made a few insignificant clean ups
v1.4 - corrected a nasty bug in the multi SPI mgr

#56312 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 23 February 2014 - 09:05 PM
in
Project Showcase
Yes it is because you are passing in the same SPI module to multiple driver instances.
As I said earlier, the driver does not yet support the same SPI module being shared among multiple driver instances.
I have to make a few adjustments for that first.
Also, I think your pin numbering might still be wrong - you must use values that are integer power of two, e.g. 1,2,4,8,16, etc. Have a look at the example I provided in post #15 above where I'm bit shifting like this "1 << Counter".
While waiting for me to update the code, you'd probably benefit more from verifying the driver works in getting a single single chip up and running.
#56313 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 23 February 2014 - 09:08 PM
in
Project Showcase
Yes, that's an excellent idea - and it would be really cool to see the software being used to drive an LCD too! TIP: Try using BurstWrite on a bus... Thanks to the pins A0,A1,A2 of each chip (reflected through the hwAddr constuctor parameter), you can cascade up to 8 chips on the same SPI bus producing a maximum of 128 GPIOs all with the same CS line - but, I need to make a few adjustments to allow the same SPI module to be shared among multiple driver instances. At present, such an attempt would result in an exception of type "resource already in use" or something like that - just like mcinnes01 just experienced. NOTE: The driver is for the SPI version, e.g. the MCP23S17 with an "S" in the middle - not the regular MCP23017 which runs on I2C.ok.. another great work Andy. so... actually i dont need to drive LCD display using M74HC595. I think it should be easier to drive it using MCP2317....
thanks in advance for hanz and andy.
#56319 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 23 February 2014 - 10:24 PM
in
Project Showcase
I just updated the driver code in post #1 - it now contains an internal light weight multiple SPI manager so you shouldn't be getting that exception anymore. Please try it when you can and report back since I haven't actually tested it myself yet....Any ideas?...


for (int ic = 0; ic < icCnt; ic++){ chip[ic] = new MCP23S17(SPI_Devices.SPI1, Pins.GPIO_PIN_D10, Pins.GPIO_NONE, ic, 7000); // Define all outputs for (int pin = 0; pin < pinCnt; pin++) Outs[16 * ic + pin] = chip[ic].CreateOutputPort((MCP23S17.Pins)(1 << pin), false);}Really anxious to know if the driver works with your board!
#56315 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 23 February 2014 - 10:04 PM
in
Project Showcase
Cool, so you "only" need to write your own LcdProvider class where you would then make internal use of the MCP23S17 driver in creating and using a bus from the pins you supply in the parameter list above - correct?
#56341 Extensive driver for the MCP23S17 I/O expander
Posted by
hanzibal
on 24 February 2014 - 07:02 PM
in
Project Showcase
- Netduino Forums
- → hanzibal's Content
- Privacy Policy