Page 7 of 23

Re: Adapter for MAPLE (Release)

Posted: Sun Oct 11, 2020 6:08 pm
by megavolt85
s_d_a_i wrote:I don't know exactly the maple documentation so I'm not sure if this is right or not.


00 00 - L R shift (not used in arcade)
FF 5F - buttons, pressed RIGHT+DOWN
80 80 80 80 - two sticks, 80 is center (not used in arcade)

Re: Adapter for MAPLE (Release)

Posted: Sun Oct 11, 2020 6:37 pm
by s_d_a_i
Ok I see, I used as guide the page https://bookstack.kairohm.dev/books/dreamcast-documentation/page/official-documentation-catchall the document E_MapleBus_Peri_HW_Spec.7z has a PDF called 05_Svs090e.pdf, there is the oficial documentation but seems the table with the read format is wrong.

Re: Adapter for MAPLE (Release)

Posted: Sun Oct 11, 2020 6:59 pm
by megavolt85
s_d_a_i wrote:there is the oficial documentation but seems the table with the read format is wrong.


that's right, you just didn't take into account that MAPLE has a different byte order
turn every four bytes and everything will become clear

Re: Adapter for MAPLE (Release)

Posted: Mon Oct 12, 2020 12:41 am
by mstar
Following with interest :)

Great project - i wonder, could we use this to somehow (not sure on the hardware-side) create a twinstick?

I mean, that'd be awesome, considering they're pretty pricey and would be a boon to have for some games :)

Re: Adapter for MAPLE (Release)

Posted: Mon Oct 12, 2020 3:32 am
by megavolt85
mstar wrote:Great project - i wonder, could we use this to somehow (not sure on the hardware-side) create a twinstick?


the most difficult thing is to make the case itself
it takes no more than half an hour to change the firmware for Twin Stick

Re: Adapter for MAPLE (Release)

Posted: Mon Oct 12, 2020 8:56 am
by megavolt85
Twin Stick

Hot keys:
X + Y + D + lLeft / lRight - Prev/Next VMU bank

Code: Select all

M25PE16     STM
1 CS    -> PA_15
2 MISO  -> PB_4
3 WP    -> +3.3V
4 Vss   -> GND
5 MOSI  -> PB_5
6 SCK   -> PB_3
7 Reset -> +3.3V
8 Vcc   -> +3.3V

Resistor 10 KOm to PB_4 and +3.3V


Code: Select all

Buttons       STM
lRIGHT    -> PA_7
lLEFT     -> PA_6
lDOWN     -> PA_5
lUP       -> PA_4
rRIGHT    -> PA_3
rLEFT     -> PA_2
rDOWN     -> PA_1
rUP       -> PA_0

D         -> PB_15
X         -> PB_14
Y         -> PB_13
START     -> PB_12
A         -> PB_11
B         -> PB_10


Code: Select all

DC         STM
1 SDCKA -> PB_8
2 Vcc   -> +5V
3 GND   -> GND
4 Sense -> GND
5 SDCKB -> PB_9


Set jumper BOOT1 for enter to USB Mode (manage virtual VMU)

twin stick.png


TwinStick.7z
(9.22 KiB) Downloaded 26 times

Re: Adapter for MAPLE (Release)

Posted: Tue Oct 13, 2020 2:13 pm
by Alexislight
hello! i have the stm32xxxxxxx! but i dont know how upload the ".bin" from PC. I need the usb to serial adaptor? please guys, could you help me with a "step by step"?

Re: Adapter for MAPLE (Release)

Posted: Tue Oct 13, 2020 3:44 pm
by megavolt85
you can use ST-LINK V2



or USB-UART


Re: Adapter for MAPLE (Release)

Posted: Wed Oct 14, 2020 3:38 am
by s_d_a_i
Hi Alexislight,

You have to download https://www.st.com/en/development-tools/stsw-link004.html#get-software if you want to program the pill with the st-link (I recommend you this way), this software installs the driver required for the st-link in order to work properly and even allows you to debug your code.

The first time you open it with the st-link on your usb port, go to "ST-LINK->Firmware update" so you have the latest firmware version on your ST-link, then "File->Open File" and load the .bin file, once loaded go to "Target->Connect" and then to "Target->Program & Verify", and now if you see no error it should be working.
(Flashing times are way worse on the clones).

Hi megavolt85,

The errors I'm having are due to the 3.3 LDO and the bad quality capacitors on the LDO prefiltering and postfiltering, the problem are the rising edges mostly, it takes a while to get to the 3.34v level and I've got a lot of packet error, this is why it has this behavior on the menu, I guess.
As I can see you have to answer before 1ms so the bus doesn't reset the device, but I think it is not mandatory to answer with 2Mbps, a response at a lower rate like 1Mbps will be accepted by the bus as well isn't it?

Re: Adapter for MAPLE (Release)

Posted: Wed Oct 14, 2020 2:34 pm
by s_d_a_i
Tested on the black pill (the one with the 5v regulator) and it is working as well.

The EMI noise problem is solved, it was the SMPS I'm using with the monitor, the ground noise was propagated to the video ground to the controller.

I have some shots comparing the "clean" signals from the Dreamcast taking control of the bus and the STM32.

This is the Dreamcast using the bus:
DC_using_bus.jpg


And this is the STM32 using the bus:
STM32_using_bus.jpg


STM32 zoomed to 200ns:
STM32_using_bus_200ns.jpg



What I've learned about the SMPS problem was the following, with some random noise there are 2 problems, one can be solved, the other not:

    1- With some noise the edges are overlapping on some bits triggering some buttons, this may be solved lowering the speed on the returned messages maybe, but I think it cannot be solved and it only happens during noise.
    2- If there is too much peak noise and the DC resets the bus the blue pill never reconnects again and the controller is lost, this doesn't happen with the real hardware.

Thank you for your time!