Skip to content

USB Host Shield based on MAX3421E interfacing with ATTiny 1634 problems #600

@ghost

Description

I am trying to interface the USB host shield with ATTiny1634MUR in QFN20 package and I am facing problems. I am using (https://github.com/SpenceKonde/ATTinyCore ) repo for ATTiny1634 and (https://github.com/felis/USB_Host_Shield_2.0) library for the USB host shield and have added the pin and board definition in USB libraries.

My USBcore.h file looks like this-

/* shield pins. First parameter - SS pin, second parameter - INT pin */
#ifdef BOARD_BLACK_WIDDOW
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
#elif defined(CORE_TEENSY) && (defined(AVR_AT90USB646) || defined(AVR_AT90USB1286))
#if EXT_RAM
typedef MAX3421e<P20, P7> MAX3421E; // Teensy++ 2.0 with XMEM2
#else
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 1.0 and 2.0
#endif
#elif defined(BOARD_MEGA_ADK)
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
#elif defined(ARDUINO_AVR_BALANDUINO)
typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
#elif defined(ARDUINO_X86) && PLATFORM_ID == 0x06
typedef MAX3421e<P3, P2> MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3
#elif defined(ESP8266)
typedef MAX3421e<P15, P5> MAX3421E; // ESP8266 boards
#elif defined(ESP32)
typedef MAX3421e<P5, P17> MAX3421E; // ESP32 boards
#elif (defined(AVR_ATmega644P) || defined(AVR_ATmega1284P))
typedef MAX3421e<Pb4, Pb3> MAX3421E;
#elif (defined(AVR_ATtiny1634))
typedef MAX3421e<Pa6,Pa5> MAX3421E;
#else
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x
#endif

My avrpins.h looks like this-

#elif defined(AVR_ATtiny1634)
#define P1 Pa6
#define P2 Pa5
#define P3 Pa4
#define P4 Pa3
#define P5 Pa2
#define P6 Pa1
#define P7 Pa0
//#define P8 Pa4
//#define P9 Pa4
#define P10 Pc5
#define P11 Pc4
#define P12 Pc3
#define P13 Pc2
#define P14 Pc1
#define P15 Pc0
#define P16 Pb3
#define P17 Pb2
#define P18 Pb1
#define P19 Pb0
#define P20 Pa7

My USBhost.h looks like this-

/* SPI pin definitions. see avrpins.h */
#if defined(PIN_SPI_SCK) && defined(PIN_SPI_MOSI) && defined(PIN_SPI_MISO) && defined(PIN_SPI_SS)
// Use pin defines: arduino/Arduino#4814
// Based on: https://www.mikeash.com/pyblog/friday-qa-2015-03-20-preprocessor-abuse-and-optional-parentheses.html
#define NOTHING_EXTRACT
#define EXTRACT(...) EXTRACT VA_ARGS
#define PASTE(x, ...) x ## VA_ARGS
#define EVALUATING_PASTE(x, ...) PASTE(x, VA_ARGS)
#define UNPAREN(x) EVALUATING_PASTE(NOTHING_, EXTRACT x)
#define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
#define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
typedef SPi< MAKE_PIN(PIN_SPI_SCK), MAKE_PIN(PIN_SPI_MOSI), MAKE_PIN(PIN_SPI_MISO), MAKE_PIN(PIN_SPI_SS) > spi;
#undef MAKE_PIN
#elif defined(AVR_ATmega1280) || (AVR_ATmega2560) || defined(AVR_ATmega32U4) || defined(AVR_AT90USB646) || defined(AVR_AT90USB1286)
typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
#elif defined(AVR_ATmega168) || defined(AVR_ATmega328P)
typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
#elif defined(AVR_ATmega644) || defined(AVR_ATmega644P) || defined(AVR_ATmega1284) || defined(AVR_ATmega1284P)
typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi;
#elif (defined(CORE_TEENSY) && (defined(MK20DX128) || defined(MK20DX256) || defined(MK64FX512) || defined(MK66FX1M0) || defined(MKL26Z64))) || defined(ARDUINO_ARC) || defined(ARDUINO_X86) || defined(MIPSEL) || defined(STM32F4)
typedef SPi< P13, P11, P12, P10 > spi;
#elif defined(ARDUINO_SAM_DUE) && defined(SAM3X8E)
typedef SPi< P76, P75, P74, P10 > spi;
#elif defined(RBL_NRF51822)

Is there anything else that has to be added to these libraries/header/C files. If anyone could suggest how to go forward or give some advice, it would be really helpful.

Thanks,
Akash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions