I have made a PCB that plugs into J14 & J17 which contains four 74LVC573 latches and a 74LVC138 address decoder. This decoder is being driven mainly off of CS2. (Seemed available) When I get an external pulse
to the PCB, I latch 32-bits of data into these latches and issue an IRQ3. I would then like to read the latches on my PCB using CS2 and A1,A2,A3 in two 16-bit reads. (Total of 32 bits). My address would be 0x?????0 and 0x?????2. My latches output to the MOD-DEV-100 board to DB16-DB31 as two 16-bit pairs. I need help setting up CS2. Please comment. I also need to know what to read to do the actual reads off the external buss. If I could find an example code that talked to the XILINX controller on the MOD-DEV-100 board I'd be half way home. I've seen some examples of setting up the CS1 but without comments, I haven't learned how to do this with CS2. I'll send anyone the ExpressPCB schematic & PCB layout if you have simular requirements. This PCB plugs right in the DEV-100 with no jumper wires. Power and ground come from the DEV-100. I think I can figure out the interrupt setup. Thank you for any help. Neil W9NU
External 16 bit data ports using a MOD5234 on MOD-DEV-100
Re: External 16 bit data ports using a MOD5234 on MOD-DEV-100
I'm not sure about the chip selects, but there is a section in the freescale manual about this. I think you need to set a base address register to the address you want in the memory map (make sure its not used), and an option register for bus size, wait states, etc.
To wire to the address bus I have done the following:
#define BASE_ADDRESS 0xbbbbbbbb // base address in memory map where b..b = address
To write 16 bits:
*(WORD *) BASE_ADDRESS = 1234; // write 1234
To read 16-bits:
WORD x = *(WORD *)BASE_ADDRESS; // read 16-bit value
You could also declare a WORD pointer which hides some of this and gives you better type checking.
WORD *pwBaseAddress = (WORD *)BASE_ADDRESS; // assign pointer
WORD x = *pwBaseAddress; // read
*pwBaseAddress = 10; // write
If I had an 8-bit bus I would use BYTE instead of WORD.
To wire to the address bus I have done the following:
#define BASE_ADDRESS 0xbbbbbbbb // base address in memory map where b..b = address
To write 16 bits:
*(WORD *) BASE_ADDRESS = 1234; // write 1234
To read 16-bits:
WORD x = *(WORD *)BASE_ADDRESS; // read 16-bit value
You could also declare a WORD pointer which hides some of this and gives you better type checking.
WORD *pwBaseAddress = (WORD *)BASE_ADDRESS; // assign pointer
WORD x = *pwBaseAddress; // read
*pwBaseAddress = 10; // write
If I had an 8-bit bus I would use BYTE instead of WORD.
Re: External 16 bit data ports using a MOD5234 on MOD-DEV-100
Thank you for you input rnixon. The write and read information is very helpful!
I've been doing programming since my first KIM1. The 32 biters are definately more complex
to set up and use. They actually almost have too much to deal with. Should it be that
hard to read 16 bits off the buss?
73's and Thanks again Neil
I've been doing programming since my first KIM1. The 32 biters are definately more complex
to set up and use. They actually almost have too much to deal with. Should it be that
hard to read 16 bits off the buss?
73's and Thanks again Neil
Re: External 16 bit data ports using a MOD5234 on MOD-DEV-100
Hi Neil,
Thanks. When you say that its hard, are you referring to the code or the chip select? I don't think the chip select is that hard either. I've been doing embedded since the 68000 days. Personally, I would rather set some bits in a chip select register than have to add external hardware to the processor for address decoding.
I found a thread on this forum with sample code for a chip select setup that may help you (searched on "chip select")
Topic: Newbie:How do I connect & access a Dual Port SRAM to MOD5270
Thanks. When you say that its hard, are you referring to the code or the chip select? I don't think the chip select is that hard either. I've been doing embedded since the 68000 days. Personally, I would rather set some bits in a chip select register than have to add external hardware to the processor for address decoding.
I found a thread on this forum with sample code for a chip select setup that may help you (searched on "chip select")
Topic: Newbie:How do I connect & access a Dual Port SRAM to MOD5270
Re: External 16 bit data ports using a MOD5234 on MOD-DEV-100
The configurations on the NetBurner side for the CPLD communication is all found in the ioboard platform source:
C:\nburn\MOD5234\system\ioboard.cpp. Are you looking for this or the HDL code for the CPLD?
The first three lines of the InitChipBoardSelect function are all that is required to configure the chip select peripheral for the 8-bit bus. Once the CS peripheral is configured and your hardware is correct is should be very easy to communicate with your device. You just create a pointer to an address on your bus and read from it. No need to worry about size of your variables, the processor will automatically handle that. For example, if you only read an 8-bit value from an address on your 16-bit bus then the processor will assert the proper byte strobe signals to tell your hardware it is only reading half the bus, you can still put out the full 16-bits and ignore the bs signals. Also if you read a 32-bit value from your bus then the processor will automatically perform 2 reads with the second read having an address 2 higher then the first read. This works the same as for your normal code which uses SDRAM for its variables. Even though the SDRAM interface is only 16-bits wide, you can still access any size variable to access its address range. You can also read and write your bus with any functions you normally use such as memcpy, memset, string functions, or any of the file descriptor functions (read, write...).
The main code difference for accessing a normal variable stored in SDRAM and your custom bus variable is that you need to specify the address for your custom bus accesses. The compiler automatically puts normal variables in the SDRAM address range because this is specified this in the platform ld file:
C:\nburn\MOD5234\lib\MOD5234.ld
C:\nburn\MOD5234\system\ioboard.cpp. Are you looking for this or the HDL code for the CPLD?
The first three lines of the InitChipBoardSelect function are all that is required to configure the chip select peripheral for the 8-bit bus. Once the CS peripheral is configured and your hardware is correct is should be very easy to communicate with your device. You just create a pointer to an address on your bus and read from it. No need to worry about size of your variables, the processor will automatically handle that. For example, if you only read an 8-bit value from an address on your 16-bit bus then the processor will assert the proper byte strobe signals to tell your hardware it is only reading half the bus, you can still put out the full 16-bits and ignore the bs signals. Also if you read a 32-bit value from your bus then the processor will automatically perform 2 reads with the second read having an address 2 higher then the first read. This works the same as for your normal code which uses SDRAM for its variables. Even though the SDRAM interface is only 16-bits wide, you can still access any size variable to access its address range. You can also read and write your bus with any functions you normally use such as memcpy, memset, string functions, or any of the file descriptor functions (read, write...).
The main code difference for accessing a normal variable stored in SDRAM and your custom bus variable is that you need to specify the address for your custom bus accesses. The compiler automatically puts normal variables in the SDRAM address range because this is specified this in the platform ld file:
C:\nburn\MOD5234\lib\MOD5234.ld