Page 1 of 1
Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 3:18 am
by Duo2k
I have a WORD Variable. I would like to output that on the "Data Bus" pins of "J1" of the Mod5270. I have already used the other GPIO pins.
Can someone point me in the right direction please?.
Thank you for your time.
Re: Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 3:33 am
by v8dave
Looking at the hardware for the databus this is not going to be possible without some extra IO connected to it. It doesn't, as far as can see support being used as GPIO.
I have an LCD connected as a 16 bit data bus so doing IO is actually quite simple with these processors as you have control of the databus size, timing etc.
You will need some kind of buffered latch, something like the 2 off 74HC573 connected to the 16 bit data bus. You need an inverter on one of the CS (chip select) outputs to enable the latch as the 573 is active HIGH and the CS is active low. Just set the OE of the 573 to always low. Any new data latched input appears on the output.
You need to programme the CHIP SELECT for the address you want use. For instance, this is what I use to enable the bus for my LCD on CS2.
#define LCDBASEADDRESS ( 0xB0000000 )
sim.cs[2].csar = ( LCDBASEADDRESS >> 16 );
sim.cs[2].cscr = 0xFDB8;
sim.cs[2].csmr = 0x001F0001;
See the processor manual for details of the values to use here but the above should work for the 573's for testing.
Good luck
Dave...
Re: Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 9:51 am
by pbreed
You need to add a 574 not a 573.
The 574 is edge triggered and you can use the rising edge of the CS signal with no inverter.
We have a VERY old app note that covers this..
http://www.netburner.com/support/techni ... v_gpio.htm
Re: Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 10:26 am
by Ridgeglider
This might also be a bit more platform specific. It came off the old YAHOO site and gives code to do a simple 1-byte data bus r/w operation for most of the various NB platforms.
Re: Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 10:29 am
by Ridgeglider
In the previous message I added a zip file named to indicate code for ONLY the 5234. It actually includes code for the the 5270, '72, '82 & '34 platforms. Sorry for the lousy file name and any confusion.
Re: Data Bus as GPIO (Beginner)
Posted: Mon Sep 27, 2010 7:48 pm
by v8dave
Thanks for the correction Paul. I had always used the 573 with an inverter, now I have something new to use for future designs and simpler too!

)
Interesting that you use the 573 for inputs!! Noted too...

)
If duo2k is using his own hardware with a Netburner module and not the dev kit, he will have to be sure to put in a bus transceiver to avoid overloading the bus on the module. Using the same one as the dev kit will give him a reliable starting point. It worked for me.
Dave...
Re: Data Bus as GPIO (Beginner)
Posted: Tue Sep 28, 2010 8:45 am
by pbreed
Yea you can do glue less 574 for outputs and 537 for inputs.
You end up burning one chipselect per device.
If you need more than the number of chip selects available then add a 138.
The 138 active low enable goes to the chipselect.
You can put R/W input one address of the 138 and address into the other two, this give you 4 read and 4 write chip
selects.
Or if you want all inputs or outputs then 3 address lines and 8 chipslects..
Paul
Re: Data Bus as GPIO (Beginner)
Posted: Tue Sep 28, 2010 4:24 pm
by Duo2k
I have ordered some 574s and are awaiting their arrival.
I examined the code posted by Ridgeglider and have some idea of how it works, or at least how to use it. I will
be sure to use driving transistors in order to protect the Netburner.
Thank you for your replies. I appreciate it.
Re: Data Bus as GPIO (Beginner)
Posted: Tue Sep 28, 2010 4:44 pm
by Ridgeglider
When you say you plan to use transistors to protect the NB, I think you may be misinterpretting the notion of adding buffers to protect the data bus. See section 6, and in particular section 6.4 of this App Note:
http://www.netburner.com/downloads/mod5 ... otes-1.pdf