• @gdsports Hi there ! -> Kinda-still-very-much-interested indeed :D

    I was coming here for a quick update & few questions, and your intervention is unexpected & full of hope ^^

    If you want some more infos on controller authentication, I can provide you the links I used while digging the subject :)
    And yes, If you do manage to get an xbox360 passthrough, it should work as expected ( allowing buttons to be either really pressed or "simulated" by the MitM code & gamepad updates to be received (rumble, leds, ..) ).
    Although I bet you could produce code that 'd work as expected to bypass the auth part only from enough infos on the way the gamepad responds once it has been fully authenticated, what about a "little" helper" ? -> as I resurrected my 1st xbox360 & until I send it to my cousin as a gift, what about sending it to you so that you can better work on that hack & have some fun doing so ? :P

    Sorry for the confusion:

    The "Xbox360 passthrough" project would be a very neat addition to the "Espruino adaptive controller" project, since it could allow using it on ALL consoles ( additionally to a computer whatever the operating system its running, as appearing as standard HID peripheral ).

    Once of the reasons I'm digging a board other than the standard Espruino ones while keeping stuff on stm32 platform is:

    • to have more pins available to be used as GPIOs, for bluetooth (hc-05) & for wifi (esp8266) without using an expander/shift register/mux & cie
    • to be able to support a "USB Host" mode with an additional USB connector
    • to be able to reuse code on official Espruino boards

    Hence, two ways to achieve the desired goal(s):

    • have a Teensy + an Espruino ( or run Espruino on the Teensy ? not my case currently .. )
    • have Espruino running on an STM32 board than provides USB Host capability & handling such feature in C++ while providing wrapper(s)/callback(s) in js

    The project is also intended as a rough template for other Espruino-based gamepads & cie ;)

    I successfully achieved HID gamepad on the STM32F407VGT6diymrOE board running only ST's code ( not Espruino ) when connecting to Windows, but for some reason it doesn't appear on Mac OS ( even with the external pull-up resistor trick, and even when pressing the btn prior to connecting the board :/ .. )

    I also had success running an Espruino build meant for the STM32F4DISCOVERY on the STM32F407VGT6diymrOE board & connecting to it via Bluetooth using an hc-05, but not via USB :/

    I'm currently digging ST's USB Host stuff & it's wayyyy over my head tight now :| ( too bad, gotta have to Digg more & harder :p )

    I recently ( yesterday actually ) created a board.py to be able to better match the STM32F407VGT6diymrOE onboard components, but for some reason I can't use 'setUSBHID()' nor the related 'send()' fcn :/ ( I guessed this comes from a flag that isn't set when building - 'USEUSBHID' if I remember correcly, but I didn't intend a custom build yet, as this was one of my questions ;) )

    On the same subject, I wonder if there's a way to set some pins as high by default within the board.py file ? ( I now know it's done in CubeMX or ST's main.c via stuff like HAL_GPIO_WritePin(EXTLED_GPIO_Port, EXTLED_Pin, GPIO_PIN_RESET); ) but I'm not sure how this is handled in the board.py file ..

    I received some necessary parts ( TRRS & TRS connectors, USB connectors ) today & since I can't find the footprints of those, I just finished digging how to do custom footprints on Eagle to "port" my Illustrator drawings as soon as I finish reporting the dimensions & pinouts & go further on this part of the project
    ( I'll post those as well as a link to where they can be purchased in few mins or tomorrow ;) )

    This being said, the following is the board.py file I intend to use for building Espruino from the latest source ( same as the F4discovery but with less stuff / different on it ): I'm still unsure if this 'll work & the exact procedure to produce a clean build but I bet digging the "building" section won't hurt ( should be one of the easier methods since this is a stm32 board .. hoping so ;) )

    # This file is part of Espruino, a JavaScript interpreter for Microcontrollers
    # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
    # This Source Code Form is subject to the terms of the Mozilla Public
    # License, v. 2.0. If a copy of the MPL was not distributed with this
    # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    # ----------------------------------------­----------------------------------------­--------
    # This file contains information for a specific board - the available pins, and where LEDs,
    # Buttons, and other in-built peripherals are. It is used to build documentation as well
    # as various source and header files for Espruino.
    # ----------------------------------------­----------------------------------------­--------
    import pinutils;
    info = {
     'name' : "STM32 F407VGT6 diymroe",
     'link' :  [ "https://edoc.site/diy-more-stm32f407vgt­6-boar1-pdf-free.html" ],
     'default_console' : "EV_SERIAL2", # FIXME: This was S2 because of pin conflict. Not sure if it's really an issue? - seemed to work for me for now ..
     'variables' : 5450,
     'binary_name' : 'espruino_%v_stm32f407vgt6diymroe.bin',
     'build' : {
       'optimizeflags' : '-O3',
       'libraries' : [
       'makefile' : [
         'DEFINES+=-DUSE_USB_OTG_FS=1 -DUSE_USB_HID=1', # trying to do USB HID stuff on the STM32F4 .. 'd be AWESOME considering the number of pins available
    chip = {
      'part' : "STM32F407VGT6",
      'family' : "STM32F4",
      'package' : "LQFP100",
      'ram' : 192,
      'flash' : 1024,
      'speed' : 168,
      'usart' : 6,
      'spi' : 3,
      'i2c' : 3,
      'adc' : 3,
      'dac' : 2,
    devices = {
      'OSC' : { 'pin_1' : 'H0',
                'pin_2' : 'H1' },
      'OSC_RTC' : { 'pin_1' : 'C14',
                    'pin_2' : 'C15' },
      'LED1' : { 'pin' : 'E0', 'pinstate' : 'IN_PULLDOWN' }, # may have to be changed to IN_PULLUP ( R: LED goes on when E0 is low - uC sinks it on )
      'BTN1' : { 'pin' : 'D15', 'pinstate' : 'IN_PULLDOWN' }, 1 should be ok ?
      'USB' : { 'pin_otg_pwr' : 'C0',
                'pin_dm' : 'A11',
                'pin_dp' : 'A12',
                'pin_vbus' : 'A9',
                'pin_id' : 'A10', },
      'JTAG' : {
            'pin_MS' : 'A13',
            'pin_CK' : 'A14',
            'pin_DI' : 'A15'
    # left-right, or top-bottom order - TODO: find a way to accomodate that ? ( ex: loading my svg with static stuff for now ? )
    board = {
      'left' : [ 'GND', 'VDD', 'GND', 'C1','C3','A1','A3','A5','A7','C5','B1',­'GND','E7','E9','E11','E13','E15','B11',­'B13','B15','D9','D11','D13','D15','GND'­],
      'left2' : [ 'GND', 'VDD', 'NRST', 'C0','C2','A0','A2','A4','A6','C4','B0',­'B2','E8','E10','E12','E14','B10','B12',­'B14','D8','D10','D12','D14','NC','GND']­,
      'right2' : [ 'GND', '5V', '3V3', 'H0', 'C14','E6','E4','E2','E0','B8','BOOT0','­B6','B4','D7','D5','D3','D1','C12','C10'­,'A14','A10','A8','C8','C6','GND'],
      'right' : [ 'GND', '5V', '3V3', 'H1', 'C15','C13','E5','E3','E1','B9','VDD','B­7','B5','B3','D6','D4','D2','D0','C11','­A15','A13','A9','C9','C7','GND'],
    board["_css"] = """
    [#board](http://forum.espruino.com/searc­h/?q=%23board) {
      width: 680px;
      height: 1020px;
      left: 200px;
      background-image: url(img/STM32F407VGT6diymroe.jpg);
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer) {
      height: 1020px;
    [#left](http://forum.espruino.com/search­/?q=%23left) {
      top: 375px;
      right: 590px;
    [#left2](http://forum.espruino.com/searc­h/?q=%23left2) {
      top: 375px;
      left: 105px;
    [#right](http://forum.espruino.com/searc­h/?q=%23right)  {
      top: 375px;
      left: 550px;
    [#right2](http://forum.espruino.com/sear­ch/?q=%23right2)  {
      top: 375px;
      right: 145px;
    def get_pins():
      pins = pinutils.scan_pin_file([], 'stm32f40x.csv', 6, 9, 10)
      return pinutils.only_from_package(pinutils.fill­_gaps_in_pin_list(pins), chip["package"])

    The attached file ( if upload works ) is the pinout for the board + few handy wip notes ( I didn't take/have the time to do a proper "background-image" for the doc part, but this is incredibly handy as is as well ;P )

    2 Attachments


Avatar for stephaneAG @stephaneAG started