Data Bus as GPIO (Beginner)

Discussion to talk about software related topics only.
Post Reply
Duo2k
Posts: 2
Joined: Mon Sep 27, 2010 3:05 am

Data Bus as GPIO (Beginner)

Post 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.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: Data Bus as GPIO (Beginner)

Post 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...
User avatar
pbreed
Posts: 1087
Joined: Thu Apr 24, 2008 3:58 pm

Re: Data Bus as GPIO (Beginner)

Post 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
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Data Bus as GPIO (Beginner)

Post 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.
Attachments
Adding (read and write) external hardware to the 5234 bus.zip
Adding exteral HARDWARE to the Netburner 5270-72-82-34 DataBus
(742.2 KiB) Downloaded 243 times
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Data Bus as GPIO (Beginner)

Post 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.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: Data Bus as GPIO (Beginner)

Post 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! :o)

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

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...
User avatar
pbreed
Posts: 1087
Joined: Thu Apr 24, 2008 3:58 pm

Re: Data Bus as GPIO (Beginner)

Post 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
Duo2k
Posts: 2
Joined: Mon Sep 27, 2010 3:05 am

Re: Data Bus as GPIO (Beginner)

Post 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.
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: Data Bus as GPIO (Beginner)

Post 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
Post Reply