-
• #2
Probably - if nothing else you could probably get kind of signal out of SPI.send4bit() or send8bit just like we do for controlling WS2812's (only with different baud rate, ofc). I assume you need to send a bunch of things like that in sequence to transmit the data?
-
• #3
Yes, the first diagram represent a "0" and the second a "1"
I was thinking to split a "n64" bit in 4 bits
so 0b0 will become 0b0001
so 0b1 will become 0b0111I need to send 0b000000011 to the controller and it will answer me 33 bits (4 bytes of data and 1 bit stop)
The N64 controller data consists of a 32 bit (4 bytes), which gives you the status (on/off) of all buttons and the joystick position (2 bytes) and one stop bit. The array is built up like this:
So 0b000000011 will become 0b000100010001000100010001000101110111 so 36bits
and the answer will be a 132 bits message.I'm not familiar with the protocol (UART, SPI), but I notice the SPI use two entries to deal with the emitter (MOSI) and the receiver (MISO).
but the n64 controller use a unique cable to transmit the data. how can I plug this king of things to the espruino ?
Hum I see
-
• #4
I guess the N64 replies after you've sent the bits?
I'd suggest you just connect SPI MISO and MOSI together, and then send the data via SPI. If you send a much larger buffer than you need, so:
0001 0111 0111 0001 .... end of data ... 0000 0000 0000 0000 0000 ...
Then you'll be able to use SPI to read the data back in at high speed too.
-
• #5
Indeed, there is several command you can send to the controller, the 0b000000011 is to have the status of all the button/joystick.
So If I understand properly:
- I connect the data pin of the controller on the MOSI pin to use it to send command
- I connect the data pin of the controller on the MISO pin to be able to read
- I send a command via MOSI, and until I receive the response I don't send anything to avoid any shortcut ?
- I receive my response so I can process stuff and be ready to send a new command.
could you be more specific about what the"larger buffer" ? :)
- I connect the data pin of the controller on the MOSI pin to use it to send command
-
• #6
Yes, connect both SPI pins to controller data, but connect SPI MOSI via a resistor (1k Ohm?) so that it isn't 'fighting' the controller for output.
could you be more specific about what the"larger buffer" ?
Sure - SPI sends out (and receives) a long stream of bits. If the controller really is sending out bits as short as 1uS that's really pretty fast, and might not be reliable with setWatch.
So what you can do is to send out the data to the controller with SPI, but also just send out lots of
0
bits as well. That won't send any data to the controller, but it will cause a series of bits to get recorded into the returned array - and you can then look at that array and try and work out what the controller sent. -
• #7
I found the OneWire library but apparently we can't we can't define the speed of the signal so I don't think I can use it because the timing is very important :s
but the send4bit method have very interesting params
bit0 The 4 bits to send for a 0 (MSB first)
bit1 The 4 bits to send for a 1 (MSB first)we can define the timing, the shape of the logic levels, so yes that sounds great but .....
I really don't like to plug the MISO and MISO pins together ... I found that a bit "dangerous" :sGordon have you some example of project where this practice is used ?
-
• #8
I don't see there's much of a problem - MOSI is an output and MISO is an input, so they can be connected fine. I do it all the time to test SPI as it echoes back what was sent.
I have done the trick with the resistor and SPI in the past to communicate with the ADNS5050
Using
send4bit
will work for transmit, but doesn't receive so it won't help you to get the result back...
Hi guys,
I want to use two espruinos pico with RF shield to remove the wire of my nintendo 64 controller
but I was wondering, Can I generate a signal like this one with it ?