Jump to content
cubeberg

Wireless NES controller - project log

Recommended Posts

So this project is in the works - but I haven't been posting much lately and I wanted to start up a thread on progress.

 

Here's the basic idea.  I have had a BeagleBone Black for quite a while.  I've mostly been using it to run my 3D printer.  However, I updated to Debian which seems much more stable than Angstrom.  I've also hooked it up to my TV and downloaded an NES emulator.  It's pretty cool, but it would be much nicer to have a real working NES controller.  I just happen to have purchased some knock-off NES controllers from eBay a while back.  I also have several NRF24L01+ radios on hand - so I figured why not!  

 

So far - I've got the hardware mapped out for the most part.  I'm planning on using an MSP430G on the controller end - hopefully using the Energia library so it's quick.  On the other end - I'm planning on using an MSP430F5529 launchpad due to the USB functionality.  The Energia library works fine on that device, so I may possibly try to get the 5529 USB keyboard example put together with the Energia library using the CCS6 Energia import functionality, but that may be a bit tough.  I'm pretty sure there are some other NRF libraries around here that I could probably use instead if needed.

 

Anyway - I'll post more info soon!

Share this post


Link to post
Share on other sites

Ok - so far I've got the 2553 transmitting the pressed keys on a regular basis.  I tried getting the Energia with the USB example, but I've got a lot of research to do to get this one going.  I might be really lazy and use a 2553 on both ends and just connect to the 5529 with GPIO.  I may try to fight this for another day or two to see if I can make any progress.  

 

I've also looked at another library by @@spirilishttps://github.com/spirilis/msprf24 - the SPI code looks like it's actually set up for the 5529 surprisingly.  It's handling some communication correctly, but I'm not quite there.  If I don't power down between running the Energia RX example and running the CCS example, I get one successful RX and then nothing.  I'm assuming it has something to do with how the NRF24L01+ was configured via Energia, or maybe the interrupt clear isn't working right.  Not sure at this point.  I'm assuming it's not initialization since the RX comes in nice and clear after the init.  I did notice that the read functionality between the energia library and the other aren't quite the same.  The CCS library reads 32 packets while the Energia looks to use the full dynamic sizing.

Share this post


Link to post
Share on other sites

Ok - so far I've got the 2553 transmitting the pressed keys on a regular basis.  I tried getting the Energia with the USB example, but I've got a lot of research to do to get this one going.  I might be really lazy and use a 2553 on both ends and just connect to the 5529 with GPIO.  I may try to fight this for another day or two to see if I can make any progress.  

 

I've also looked at another library by @@spirilishttps://github.com/spirilis/msprf24 - the SPI code looks like it's actually set up for the 5529 surprisingly.  It's handling some communication correctly, but I'm not quite there.  If I don't power down between running the Energia RX example and running the CCS example, I get one successful RX and then nothing.  I'm assuming it has something to do with how the NRF24L01+ was configured via Energia, or maybe the interrupt clear isn't working right.  Not sure at this point.  I'm assuming it's not initialization since the RX comes in nice and clear after the init.  I did notice that the read functionality between the energia library and the other aren't quite the same.  The CCS library reads 32 packets while the Energia looks to use the full dynamic sizing.

FYI the msprf24 lib can use dynamic sizing too, it just doesn't mandate it all the time like Enrf24 (and that needs to be enabled on both sides or else it usually doesn't work at all)...

Can you send me your code?

Share this post


Link to post
Share on other sites

Ok - I made some progress.  I switched to 8-bit CRC.  Looks like that's the default setting for the Energia library.  Unfortunately, the data I'm getting is incorrect.  I tried transmitting 0x08 and I get 0x38.  

Here's my update to the InitRF code I uploaded

void InitNRF()
{
	P4DIR = 0x00;
	/* Initial values for nRF24L01+ library config variables */
	//rf_crc = RF24_EN_CRC | RF24_CRCO; // CRC enabled, 16-bit
	rf_crc = RF24_EN_CRC; // CRC enabled, 8-bit
	rf_addr_width      = 5;
	rf_speed_power     = RF24_SPEED_1MBPS | RF24_POWER_0DBM;
	rf_channel         = 0;




	msprf24_init();
	msprf24_set_pipe_packetsize(0, 0);
	msprf24_open_pipe(0, 1);  // Open pipe#0 with Enhanced ShockBurst

	w_rx_addr(0, addr);
	w_rx_addr(1, addr);

	msprf24_irq_clear(RF24_IRQ_RX);

	// Receive mode
	if (!(RF24_QUEUE_RXEMPTY & msprf24_queue_state())) {
		flush_rx();
	}
	msprf24_activate_rx();
}

Share this post


Link to post
Share on other sites

Good progress.  Got the controller built - it works on my BBB, but it's awfully laggy.  I'm going to have to see if I can increase speed/frequency and see if that helps.  I'm also going to have to dig into the USB example I'm using to see what CPU speed the 5529 is running at.

Share this post


Link to post
Share on other sites

Ok - I've pretty much wrapped this up.  It's been done for a while, but I haven't used it a ton so far.  

 

5529 Launchpad - I'm using one of @@spirilis 's original NRF boosterpacks - http://forum.43oh.com/topic/2696-snordic-nrf24l01-rf-boosterpack/.  Had to add a jumper to a different pin for the IRQ because that pin on the 5529 didn't have interrupt capability.  

 

Code works in CCS (couldn't use Energia - couldn't find any USB examples) 5529_NES.zip

 

The other side uses a 2553.  Managed to squeeze everything into the NES controller except the batteries.  

 

Again - Works in CCS.  Wanted to take advantage of the low power.  I actually had this flipped on for a week without realizing - still plenty of battery :)  2553_NESController.zip

 

I fixed the lagginess by only transmitting when there was a change in keys.  

 

The only real issue I've run into - the D-pad is a bit "mushy" - unless you're really careful - pushing on one direction typically triggers one of the others next to it.  Not bad for Mario - but probably pretty annoying for something else.  That's what I get for buying a cheap knock-off :)

This could easily be migrated to a 28 pin 2553 and expanded to a SNES controller (planning on that at some point).

 

And here are some pics of the outcome:

post-1690-0-98464000-1410225413_thumb.jpg

post-1690-0-36719400-1410225437_thumb.jpg

Share this post


Link to post
Share on other sites

There isn't much there for Energia and USB... though I think that can change soon as the USB API fully supports GCC. When the new RedHat GCC replaces the current-day mspgcc things will get nice (use all 128K flash for one).

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...