NetBurner Data Bus
NetBurner Data Bus
I need to interface a peripheral with the NetBurner's (Mod5282) data bus, but have not found any resources explaining the process, particularly the software side. I need to read 10 bits of data off of a ~100,000 deep FIFO I've instantiated on an FPGA. If any one can point me in some direction, I'd appreciate it. I've looked through some of the examples provided by NetBurner, but it's not obvious that any of them use the data bus to read data off of a peripheral.
- Chris Ruff
- Posts: 222
- Joined: Thu Apr 24, 2008 4:09 pm
- Location: topsail island, nc
- Contact:
Re: NetBurner Data Bus
here's some code I use to interface the 5282 to an off-chip parallel flash chip.
remember to use a buffer on the datalines, especially
Chris
//
// set up CS1 for the flash
//
// **||*************************************************************
char InitOffChipFlashChip()
// **||*************************************************************
{
//flash goes from 3000000 to 301fffff
// 1fffff
// base address
sim.cs[1].csar = (FLASHCHIPLOC >> 16);
// WS A 32
// |2ws|0A PS
sim.cs[1].cscr = 0x1d80; /* 0000 1101 1000 0000 */
// bit 0 == 1 means all above is valid....
sim.cs[1].csmr = 0x00ff0001; // the ff is the block size
// return ( PWORD ) ( WIFIBASEADDRESS );
return 0;
}
// **||****************************************************************
void OffChipFlashProgram( void *pWhere, void *pWhat, int len )
// **||****************************************************************
{
volatile unsigned short *pFlashBase1 = ( volatile unsigned short * ) FLASHADDR1;
volatile unsigned short *pFlashBase2 = ( volatile unsigned short * ) FLASHADDR2;
volatile unsigned short *pDataTo = ( volatile unsigned short * ) pWhere;
volatile unsigned short *pDataFrom = ( volatile unsigned short * ) pWhat;
while ( len >= 2 )
{
if ( ( *pDataTo & *pDataFrom ) == *pDataFrom )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x00A0;/* FlashCommand(Flash555,0x00A0);*/
*pDataTo = *pDataFrom;
while ( *pDataTo != *pDataFrom );
}
pDataTo++;
pDataFrom++;
len -= 2;
}
if ( len )
{
volatile unsigned short tv = *( ( ( volatile unsigned char * ) pWhat ) + len );
tv = tv << 8;
tv = tv | ( ( *pDataTo ) & 0xFF );
*pDataTo = tv;
if ( ( *pDataTo & tv ) == tv )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x00A0;/* FlashCommand(Flash555,0x00A0);*/
*pDataTo = tv;
while ( *pDataTo != tv );
}
}
}
// **||****************************************************************
void OffChipFlashErase( void *pWhere, int len )
// **||****************************************************************
{
volatile unsigned short *pFlashBase1 = ( volatile unsigned short * ) FLASHADDR1;
volatile unsigned short *pFlashBase2 = ( volatile unsigned short * ) FLASHADDR2;
volatile unsigned short *pData = ( volatile unsigned short * ) pWhere;
while ( len >= 2 )
{
if ( *pData != 0xFFFF )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x0080;/* FlashCommand(Flash555,0x0080);*/
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pData = 0x0030;
while ( *pData != 0xFFFF );
}
pData++;
len -= 2;
}
}
remember to use a buffer on the datalines, especially
Chris
//
// set up CS1 for the flash
//
// **||*************************************************************
char InitOffChipFlashChip()
// **||*************************************************************
{
//flash goes from 3000000 to 301fffff
// 1fffff
// base address
sim.cs[1].csar = (FLASHCHIPLOC >> 16);
// WS A 32
// |2ws|0A PS
sim.cs[1].cscr = 0x1d80; /* 0000 1101 1000 0000 */
// bit 0 == 1 means all above is valid....
sim.cs[1].csmr = 0x00ff0001; // the ff is the block size
// return ( PWORD ) ( WIFIBASEADDRESS );
return 0;
}
// **||****************************************************************
void OffChipFlashProgram( void *pWhere, void *pWhat, int len )
// **||****************************************************************
{
volatile unsigned short *pFlashBase1 = ( volatile unsigned short * ) FLASHADDR1;
volatile unsigned short *pFlashBase2 = ( volatile unsigned short * ) FLASHADDR2;
volatile unsigned short *pDataTo = ( volatile unsigned short * ) pWhere;
volatile unsigned short *pDataFrom = ( volatile unsigned short * ) pWhat;
while ( len >= 2 )
{
if ( ( *pDataTo & *pDataFrom ) == *pDataFrom )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x00A0;/* FlashCommand(Flash555,0x00A0);*/
*pDataTo = *pDataFrom;
while ( *pDataTo != *pDataFrom );
}
pDataTo++;
pDataFrom++;
len -= 2;
}
if ( len )
{
volatile unsigned short tv = *( ( ( volatile unsigned char * ) pWhat ) + len );
tv = tv << 8;
tv = tv | ( ( *pDataTo ) & 0xFF );
*pDataTo = tv;
if ( ( *pDataTo & tv ) == tv )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x00A0;/* FlashCommand(Flash555,0x00A0);*/
*pDataTo = tv;
while ( *pDataTo != tv );
}
}
}
// **||****************************************************************
void OffChipFlashErase( void *pWhere, int len )
// **||****************************************************************
{
volatile unsigned short *pFlashBase1 = ( volatile unsigned short * ) FLASHADDR1;
volatile unsigned short *pFlashBase2 = ( volatile unsigned short * ) FLASHADDR2;
volatile unsigned short *pData = ( volatile unsigned short * ) pWhere;
while ( len >= 2 )
{
if ( *pData != 0xFFFF )
{
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pFlashBase2 = 0x0080;/* FlashCommand(Flash555,0x0080);*/
*pFlashBase2 = 0x00AA;/* FlashCommand(Flash555,0x00AA);*/
*pFlashBase1 = 0x0055;/* FlashCommand(Flash2aa,0x0055);*/
*pData = 0x0030;
while ( *pData != 0xFFFF );
}
pData++;
len -= 2;
}
}
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: NetBurner Data Bus
See the zipped files attached to this post.
These demos used to be on the NB site somewhere, but I couldn't find a link to them so here they are again. They may have been on the old yahoo group which was replaced by this forum a few years ago.
(NB guys, it would be nice to be sure that material remains available and more accessible. I'd vote for them to be included with the basic NB install in the docs or examples directories...
If you search this forum for sim.cs, you will get some add'l material.
see also:
http://forum.embeddedethernet.com/viewt ... ?f=5&t=449
http://forum.embeddedethernet.com/viewt ... ?f=3&t=427
see also the hardware signal description:
http://www.netburner.com/downloads/mod5 ... 1&view=Fit
These demos used to be on the NB site somewhere, but I couldn't find a link to them so here they are again. They may have been on the old yahoo group which was replaced by this forum a few years ago.
(NB guys, it would be nice to be sure that material remains available and more accessible. I'd vote for them to be included with the basic NB install in the docs or examples directories...
If you search this forum for sim.cs, you will get some add'l material.
see also:
http://forum.embeddedethernet.com/viewt ... ?f=5&t=449
http://forum.embeddedethernet.com/viewt ... ?f=3&t=427
see also the hardware signal description:
http://www.netburner.com/downloads/mod5 ... 1&view=Fit
- Attachments
-
- BusRW34.zip
- Data bus R/W for various platforms
- (2.14 KiB) Downloaded 310 times
-
- DataBus-70-72-82.zip
- (743.29 KiB) Downloaded 308 times
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: NetBurner Data Bus
Don't forget the C:\Nburn\docs\FreescaleManuals\MCF5282UM.pdf chapter 12 on the 5282's chip select module