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

is the next new netduino hardware has a 176 pins version?


  • Please log in to reply
28 replies to this topic

#1 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 15 February 2013 - 03:40 PM

is the next new netduino hardware has a 176 pins version?why i ask this because i think we can learn more from more pins,i dont think the size of the develop board does matter,and it is more easier to reduce from more to less than to extend from less to more,i just bought my N+2 one week ago,and i would like to wait for a more pins Netduino to release~~



#2 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 15 February 2013 - 05:57 PM

Hi,

 

 

There are many ways to add more pins, an easy way to add outputs is using SPI with 74HC595 shift registers. A simple class will allow you to set the outputs, and will allow more registers to be added. I did this to add a display of 8 LEDs to my buggy.

There are examples on the Wiki.

 

I guess inputs are not quite as good using shift registers (eg 74HC165) because you tend not to get interrupts on level change.

 

There are also I2C chips and I'm certain there are ready built shields too.

 

You might be better off looking into these instead of waiting for a bigger Netduino ;-)

 

Have fun - Paul



#3 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 15 February 2013 - 06:25 PM

hi,Paul

i know there are many ways to extend input and output pins,but there is one big problem,thats decrease the performance,for example,use one 74hc595 for output,use it to controls 8 other ICs,if you want to send one byte to the last IC,you have to do 8 times works than just use an existed pin(becuase it use one pulse to move one bit from left to right),its worse performance~~sorry for my bad english~~hope you understand what im saying~~~



#4 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 15 February 2013 - 06:59 PM

Yes you are correct, it will be slower.

When serial registers are placed in series with a single strobe, the more 74HC595s you add the slower it gets!

The software tends to stay the same no matter how many you add.

 

How fast do you need to set outputs?

Do you need to change one at a time - or change several in one go?

 

One option might be to use shift registers in parallel with different strobe lines. This would use up more gpio, but then the delay would only be the time for 8 bits.

 

Paul



#5 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 15 February 2013 - 07:34 PM

im working on a project thats contains 36 chips,use up to 40 pins,and it contains 126 buttons(i used 74hc165 for this),when the button is pressed,certain chip has to do something,so pins are very important to me,but the netduino platform only provided like 20 IOs,because it used a 64 pins chip,the reason why i bought the netduino is because its 100% open sources,if i change to the 176 pins STM32F405 chip,i must to do the porting things even it can runs on a 176 pins chip without any firmware code changed,but the pins will useless,(beacuse it has to assign the pins for SPI,I2C,PWM something like these),but i dont know how to do the porting,so i cant change the chip to get more pins,the 176 pins chip only cost $2-4 more than the 64 pins chip,and i dont mind the size of the develop board,and dont mind to pay $10 more to purchase a 176 pins hardware~~~



#6 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 15 February 2013 - 09:56 PM

Wow - lots of inputs and outputs.

 

How are the buttons arranged?

Is it a keypad which can be scanned as a matrix?

 

I wrote a Wiki page about a crazy idea for scanning a matrix using SPI. The wiki page shows scanning a 4x4 matrix using one 74HC595, it only takes 8 clocks to scan a 4x4 matrix.

You can add more 74HC595s to increase the rows and columns.

e.g two x 74HC595 = 8x8 (16 clocks), three = 12x12 (24 clocks), ...

 

I am fairly certain the idea can be used at the same time as other 74HC165 inputs and 74HC595 outputs - but I have not tried it myself.

 

Paul



#7 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 15 February 2013 - 10:10 PM

the way you did for the matrix keypad i had already used for two years ago,in my project im not using the matrix keypad,because it doesnt supported keys combination(i dont want to use that much diodes to make it supported),so i used 74hc165 for making the independence key....



#8 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 16 February 2013 - 06:56 AM

id replace the 165 with something that has interrupts - polling is your perferomance killer here.

there is mcp23s17 (spi) and mcp23017 (i2c) wich are great for both inputs and outputs.

 

also, i dont think 74hc595's is much slower than more pins would be.

my test: just the performance counter code running: 8000 updates per sec.

turning 8 pins on/off = 4000 updates per sec.

turning 16 pins = 2000 updates per sec. so this is slow too.

 

but id totally avoid polling the 165



#9 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 16 February 2013 - 09:37 AM

why you dont think 74hc595 is much slower than the original pin?1 byte equal 8 bits,you can just think if you want to send one byte to the last pin of the first 74hc595,you have to loop 8 times to move one bit from head to tail,what happen if you serial 36 chip(there is not enough pins for parallel)?the performance is horrible,if you want to send one byte to the last pin of the last chip,you have to loop 36 * 8 = 288 times,what happen if you want to send byte to all the pins of these 36 chips?you have to loop 288! times,it will takes more than 5 mins to finish this i think,and the 74hc165 i will use one pin for the interrupt of the LowEdge(i have not started this yet,but i think there whill be no problems)

Anyways,just thankyou Noom for giving me some other chips for this



#10 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 16 February 2013 - 10:00 AM

After your last comment I am not sure if you realise that the 74HC595 can be driven very fast using the built in SPI port.

There is no need to write a loop in software, just set a byte or an array of bytes and start the transfer.

The hardware does the loop so it is much faster than a software loop.

 

The Netduino software does not allow you to write a byte to 8 GPIOs (without creating a collection of pins), so with high numbers of GPIO, you need lots of function calls to set all the pins. With high numbers of pins you might even find that the SPI method is quicker!

 

Have a good weekend!



#11 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 16 February 2013 - 10:24 AM

iam also not sure if you know what your talking about the 165 .. they have no interrupt pin..

the chips i suggested have 1 outgoing pin to your uC .. it tells you wnether an port changed, than you read it, the 165 cant do that.

you have to constantly ask them about their pin states.

 

also, the 595's are very very fast, and as paul said, maybe even faster than toggling single pins.

you can even chain them, and writing like 30 bytes (for 30 595's = 240 pins) at 10 mhz is outstanding fast.

you set the single bits in the bytes with bitshifting/bitmaks/whatever.

 

i tried all chips, and this is my experience.



#12 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 16 February 2013 - 10:56 AM

hi NooM,i dont need the 74hc165 to has a interrupt pin,i can use a pin from the CPU to use as a interrupt pin,you didnt know this?

and you still dont understand what i mean for very slow for using 595,i didnt said the 595 is slow,i dont know how to explain,just think about how the 595 works,if send a byte from a existed pin on the CPU to an IC,you have to loop 8 times to send 8 bits as a byte,if you connect a IC on the last pin of the 595,if you want to send a byte throught the 595 then to IC,you have to loop 64 times for moving 8 bits from the first pin of the 595 to the last pin of the 595,and this will worse 8 times of performance for the CPU for just uing one 595,if you serial many 595,the performance is horrible as you cant think....



#13 Nevyn

Nevyn

    Advanced Member

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

Posted 16 February 2013 - 12:35 PM

if send a byte from a existed pin on the CPU to an IC,you have to loop 8 times to send 8 bits as a byte,if you connect a IC on the last pin of the 595,if you want to send a byte throught the 595 then to IC,you have to loop 64 times for moving 8 bits from the first pin of the 595 to the last pin of the 595,and this will worse 8 times of performance for the CPU for just uing one 595,if you serial many 595,the performance is horrible as you cant think....

Are you sending the data to the 595 using SPI?

 

It sounds like you are bit-banging the data through a GPIO pin.

 

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


#14 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 16 February 2013 - 01:33 PM

well, you ask me if i dont understand this, but in fact, i do.

 

now, when the 595's are so slow, why so many ppl use it for led-matrixes? with a thousands of leds w/o problems?

i myself am using 4 595's and much ohter code running, and still get an updaterate of 100-200 times.

 

for the 165: you still dont get what i mean, yes the uC (its not a cpu ...) has interrupt pins, and any chip that supports it tells the

uC that something on its pins changed. whats the code you use for your 165?

 

when i made inputs with external ic's i used the pfc8574 and the mcp23017, as soon as any pin of them changed they throw an

interrupt on the netduino, than i read (within the interrupt) wich pin it actually was.

 

with the 165 i had to "ask" (poll) them constantly to get the data and than compare it with the last poll to see if anything has changed.

now thats not stupid - thats the only way they tell you what changed :P

 

 

but well, do whatever you like.

 

to your initial question: iam very sure there never will be a 176pin version, but you can make one youself.

make a design for the 176pin chip, add the same crystal oscillator (or use an gcc port, or even use different .netmf firmware) -

flash it - done. i myself use a 100 pin board. (not for normal i/o's)



#15 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 16 February 2013 - 02:11 PM

hi Nevyn,i did used the SPI for the 74hc595,but at a lower level,it works the same way~~~

 

hi NooM,the workloads of using 74hc595 to control the led matrix is very very very diffent to using 74hc595 to control ICs such as Max7219/Max7221,just imaging in your mind,there are 36 74hc595 connected by serial,and each pin of the 74hc595 control one max7219/max7221,and you would like to fresh them all,just think how long it would be done for this...



#16 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 16 February 2013 - 02:58 PM

you are right, that wouldnt be very fast.

and you want the extra pins for chipselect?

 

id also suggest give more information next time. i assumed you just want normal outputs.

driving them per spi and just use the extra-pins as chipselect would be fastest way ofc.

 

with 74hc138 you can multiplex pins, like with 3 real pins you can get 8

 

 

edit: keep in mind that the spi is in hardware, so thats really really fast.

if you have an oscilloscope you can meassure turning a pin on and off in a loop, and doing the same with

byte like 10101010 .. where spi beats the pin turning by far.



#17 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 16 February 2013 - 03:04 PM

i did tried to use the 74hc595 for the chip select,but it didnt provided the performace i want,thats why i want to get a more pins processor,im looking into the codes of the firmware,i hope i can build my own platform......

 

big thanks to you NooM,i had learned many things from the posts from you guys in this thread...



#18 Nevyn

Nevyn

    Advanced Member

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

Posted 16 February 2013 - 03:55 PM

hi Nevyn,i did used the SPI for the 74hc595,but at a lower level,it works the same way~~~

You say it works the same way - i.e. looping for each bit but I never had to do that.  If you look at this shift register class I wrote a while ago I never had to loop over the bits.  I overloaded the [] operator to treat the pins on the shift registers as elements of an array and let SPI do all the hard work getting the data out to the 595's.

 

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


#19 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 17 February 2013 - 07:49 PM

Could you draw a diagram of the displays and switches you are trying to use.

I'm sure we can come up with more ideas for you if you show us a picture of the problem.....

 

Paul



#20 weixiongmei

weixiongmei

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationPhiladelphia, Pennsylvania, United States

Posted 18 February 2013 - 12:09 AM

hi paul,here is my bad drawing picture.....

thanks for you help~~~






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.