Любой может помочь мне получить MIDI с STM32F1?

Jackie393
Пт 19 октября 2018 г. 12:58
У меня черная таблетка. Я хочу получить вход MIDI с STM32F1 через USB MIDI Device (не последовательно) (я отправляю MIDI с канала = 1 и примечание 1).

Но это не работает. Любой может мне помочь?. Извините, мой английский

Здесь мой код //Reset the USB interface on generic boards - developed by Victor PV gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP); gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0); for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);

Моду
Пт 19 октября 2018 г., 15:45
Мне кажется, что Миди - это в основном специализированная серийная связь.
Я нашел эту старую ветку на форумах Arduino, вы смотрели на нее?

http: // форум.Ардуино.CC/INDEX.PHP?Тема = 22447.0
//Reset the USB interface on generic boards - developed by Victor PV gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP); gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0); for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);

Mrburnette
Пт, 19 октября 2018 г., 23:40
Поиск, ориентированный на сайт, показывает эти ресурсы форума:
https: // www.Google.com/search?источник = hp ... 2duino.компонент

Удачи... Кроме того, один из наших членов написал Midi Lib... ViewTopic.PHP?f = 13&t = 2926



Луча

Арпрос
Сб 20 октября 2018 г. 14:21
Аппаратное обеспечение USB на STM32F1 предоставляет USB -хост, поэтому вы не можете подключиться к назначенному USB -устройству, только на компьютер, телефон и т. Д.

Мадиас
Сб 20 октября 2018 г. 20:56
1. Вы не читали тщательно, что Рэй разместил вам: ViewTopic.PHP?f = 2&t = 3111 В противном случае вы бы дали нам - по крайней мере - Информация о ядро, которое вы используете (Официальный Роджер один....) И ОС, которую вы используете (Windows, OSX, Linux)
Здесь несколько общих советов для ядра Роджера:
2. Если вам нужен USB MIDI: возьмите пример из «Примеров» -> "USB Composite для STM32F1" -> "Midiin" и "Midiout". Играйте с ними и измените его для ваших нужд. Если вы используете функцию поиска, вы найдете обязательные записи для более старого подхода для USB MIDI. USB MIDI теперь является частью библиотеки «USB Composite», поэтому вам нужно изменить примеры. (сорт....)
Это очень простой MIDI в примере, он работает из коробки с ядром Роджера и Win10 & OSX:
Пожалуйста, установите Speaker_pin для любого светодиода на вашей черной таблетке. После загрузки, на win10 & OSX Черная таблетка распознается как MIDI -устройство "Maple". Зайдите в свой секвенсор и отправьте заметку включено/выключено, чтобы вы увидели мигание светодиода. Имейте в виду, что использование MIDI Serial вы потеряете серийный монитор в Arduino IDE (причина нечетной миди -бодской скорости 31250 - серийный монитор Arduino не может справиться с этим, возможно, сторонний монитор выполнит эту работу) // STM32_PIR_Blink - Simple Low Power demo using a PIR or other "button" // // Board speed is reduced to 8MHz, sketch responds to interrupt on pin BOARD_BUTTON and changes the state of the LED. // // At 72 MHz, the sketch consumes between 44.3mA and 46.5mA // Slowing the clock and using WFI, the sketch consumes ~9.5mA - around 4mA of this will be the voltage regulator + the power LED, // so the STM32F103R8T6 used for testing was only drawing about 5.5mA, while still running 32 bit ARM code at 8MHz. Not too shabby. // // Ensure you set the correct mode for the input, depending on your "button", one of INPUT, INPUT_PULLUP or INPUT_PULLDOWN // Ths sketch was tested with with a button to ground (set the type to INPUT_PULLUP), and also with an HC-SR591 PIR (set the type to INPUT) // HC-SR591 PIR => http://www.ebay.com/sch/i.html?_from=R40&_sacat=0&_sop=15&_nkw=hc-sr501%20pir%20motion%20sensor&rt=nc&LH_BIN=1&_trksid=p2045573.m1684 // These will generally operate down to 3.3V. Output *should* be 3.3 safe with VCC <20V, but check the spec. of the PIR or you may release the magic smoke. // Test system - Generic STM32F103R8T6 board with RTC battery and crystal fitted. PIR attached to BOARD_BUTTON_PIN LED attached to BOARD_LED_PIN // 2nd button (from generic 2.2" touch screen LCD display board) attached to PA0 // Pressing the display button caues a software reset (systemHardReset) using nvic_sys_reset(); // The ultimate idea being to wakeup with this button, and when we are // later doing nothing (no user input from the touch screen, or exit from menu), we drop in to sleep mode, monitoring the PIR and the RTC. // // As a side effect of this, I can flash code to the board by pressing the display button as the subsequent reboot enables the bootloader. // Defined for power and sleep functions pwr.h and scb.h #include #include int BOARD_LED_PIN = PB0; int BOARD_BUTTON = PA15; int DISPLAY_BUTTON = PA0; volatile bool boardButtonInterruptFlag = false; volatile bool displayButtonInterruptFlag = false; void boardButtonInterrupt() { boardButtonInterruptFlag = true; } void displayButtonInterrupt() { displayButtonInterruptFlag = true; } void setup() { for (int i = 0; i < 4; i++) { pinMode(BOARD_LED_PIN, OUTPUT); digitalWrite(BOARD_LED_PIN, 1); toggleLED(); delay(100); toggleLED(); delay(100); } // Slow down to 8MHz (current drops to ~ 18mA clockARM8(); disableClocks(); delay(1000); pinMode(BOARD_BUTTON, INPUT); pinMode(DISPLAY_BUTTON, INPUT_PULLUP); attachInterrupt(BOARD_BUTTON, boardButtonInterrupt, CHANGE); attachInterrupt(DISPLAY_BUTTON, displayButtonInterrupt, CHANGE); } void loop() { // WFI - current drops to ~12mA // sleepMode(); standbyModeDeepsleep(); //stopModeDeepsleep; if (boardButtonInterruptFlag) { //toggleLED(); delay(10); //toggleLED(); boardButtonInterruptFlag = false; } // Someone pressed or released a button... Do stuff... wake up the dog, photgraph the wild life, switch on the air raid siren.. or whatever. digitalWrite(BOARD_LED_PIN,(!digitalRead(BOARD_BUTTON))); // toggleLED(); if(displayButtonInterruptFlag) { //Someone Pressed the button on the display. systemHardReset(); } } void toggleLED() { digitalWrite(BOARD_LED_PIN, (!digitalRead(BOARD_LED_PIN))); } void clockARM8() { // Switch to the 8MHz external clock. We loose USB, but we consume 2/3 less power. rcc_switch_sysclk(RCC_CLKSRC_HSE); } void disableClocks() { // Disable all peripheral clocks except GPIOA, GPIOB and TIMER1 rcc_clk_disable(RCC_ADC1); rcc_clk_disable(RCC_ADC2); rcc_clk_disable(RCC_ADC3); rcc_clk_disable(RCC_AFIO); rcc_clk_disable(RCC_BKP); rcc_clk_disable(RCC_CRC); rcc_clk_disable(RCC_DAC); rcc_clk_disable(RCC_DMA1); rcc_clk_disable(RCC_DMA2); rcc_clk_disable(RCC_FLITF); rcc_clk_disable(RCC_FSMC); //rcc_clk_disable(RCC_GPIOA); //rcc_clk_disable(RCC_GPIOB); rcc_clk_disable(RCC_GPIOC); rcc_clk_disable(RCC_GPIOD); rcc_clk_disable(RCC_GPIOE); rcc_clk_disable(RCC_GPIOF); rcc_clk_disable(RCC_GPIOG); rcc_clk_disable(RCC_I2C1); rcc_clk_disable(RCC_I2C2); rcc_clk_disable(RCC_PWR); rcc_clk_disable(RCC_SDIO); rcc_clk_disable(RCC_SPI1); rcc_clk_disable(RCC_SPI2); rcc_clk_disable(RCC_SPI3); rcc_clk_disable(RCC_SRAM); //rcc_clk_disable(RCC_TIMER1); rcc_clk_disable(RCC_TIMER2); rcc_clk_disable(RCC_TIMER3); rcc_clk_disable(RCC_TIMER4); rcc_clk_disable(RCC_TIMER5); rcc_clk_disable(RCC_TIMER6); rcc_clk_disable(RCC_TIMER7); rcc_clk_disable(RCC_TIMER8); rcc_clk_disable(RCC_TIMER9); rcc_clk_disable(RCC_TIMER10); rcc_clk_disable(RCC_TIMER11); rcc_clk_disable(RCC_TIMER12); rcc_clk_disable(RCC_TIMER13); rcc_clk_disable(RCC_TIMER14); rcc_clk_disable(RCC_USART1); rcc_clk_disable(RCC_USART2); rcc_clk_disable(RCC_USART3); rcc_clk_disable(RCC_UART4); rcc_clk_disable(RCC_UART5); rcc_clk_disable(RCC_USB); } void systemHardReset(void) { // Perform a system reset, see ../libmaple/nvic.c for the method nvic_sys_reset(); // We will never get any further than this. } void sleepMode() { asm(" WFI"); } void stopModeDeepsleep() { // Clear PDDS and LPDS bits PWR_BASE->CR &= PWR_CR_LPDS | PWR_CR_PDDS | PWR_CR_CWUF; // System Control Register Bits. See... // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihhjgdh.html // Stop mode "PDDS and LPDS bits + SLEEPDEEP bit + WFI " // Low-power deepsleep bit. // PWR_BASE->CR |= PWR_CR_LPDS; // Set PDDS and LPDS bits for standby mode, and set Clear WUF flag (required per datasheet): PWR_BASE->CR |= PWR_CR_CWUF; // PWR_BASE->CR |= PWR_CR_LPDS; PWR_BASE->CR |= PWR_CR_PDDS; // Enable wakeup pin bit. PWR_BASE->CR |= PWR_CSR_EWUP; // Set Power down deepsleep bit. // PWR_BASE->CR |= PWR_CR_PDDS; // Unset Low-power deepsleep. // PWR_BASE->CR &= ~PWR_CR_LPDS; // Set sleepdeep in the system control register - if set, we deepsleep and coldstart from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; // Now go into ARM halt mode, wake up on interrupt asm(" wfi"); } void standbyModeDeepsleep() { // Clear PDDS and LPDS bits PWR_BASE->CR &= PWR_CR_LPDS | PWR_CR_PDDS | PWR_CR_CWUF; // System Control Register Bits. See... // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihhjgdh.html // Stop mode "PDDS and LPDS bits + SLEEPDEEP bit + WFI " // Low-power deepsleep bit. // PWR_BASE->CR |= PWR_CR_LPDS; // Set PDDS and LPDS bits for standby mode, and set Clear WUF flag (required per datasheet): PWR_BASE->CR |= PWR_CR_CWUF; // PWR_BASE->CR &= ~PWR_CR_LPDS; PWR_BASE->CR |= PWR_CR_PDDS; // Enable wakeup pin bit. PWR_BASE->CR |= PWR_CSR_EWUP; // Set Power down deepsleep bit. // PWR_BASE->CR |= PWR_CR_PDDS; // Unset Low-power deepsleep. // PWR_BASE->CR &= ~PWR_CR_LPDS; // Set sleepdeep in the system control register - if set, we deepsleep and coldstart from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; // Now go into ARM halt mode, wake up on interrupt asm(" wfi"); }

Jackie393
Ср 24 октября 2018 г., 4:29
[Мадиас - Сб 20 октября 2018 г. 20:56] - #include #include #include #include #include RTClock rt (RTCSEL_LSE); // initialise uint32 tt; #define LED_PIN PC13 // This function is called in the attachSecondsInterrpt void sleepMode(bool deepSleepFlag) { // Clear PDDS and LPDS bits PWR_BASE->CR &= PWR_CR_LPDS | PWR_CR_PDDS | PWR_CR_CWUF; // Set PDDS and LPDS bits for standby mode, and set Clear WUF flag (required per datasheet): PWR_BASE->CR |= PWR_CR_CWUF; PWR_BASE->CR |= PWR_CR_PDDS; // Enable wakeup pin bit. PWR_BASE->CR |= PWR_CSR_EWUP; // Low-power deepsleep bit. // PWR_BASE->CR |= PWR_CR_LPDS; // System Control Register Bits. See... // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihhjgdh.html if (deepSleepFlag) { // Experimental // Set Power down deepsleep bit. PWR_BASE->CR |= PWR_CR_PDDS; // Unset Low-power deepsleep. PWR_BASE->CR &= ~PWR_CR_LPDS; // Set sleepdeep in the system control register - if set, we deepsleep and coldstart from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; } else { // Unset Power down deepsleep bit. PWR_BASE->CR &= ~PWR_CR_PDDS; // set Low-power deepsleep. PWR_BASE->CR |= PWR_CR_LPDS; /*/ * PWR_CR_PDDS Power down deepsleep. PWR_CR_LPDS Low-power deepsleep. */ // Unset sleepdeep in the system control register - if not set then we only sleep and can wake from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; // Low-power deepsleep bit. } // Set end Event on Pending bit: - enabled events and all interrupts, including disabled interrupts, can wakeup the processor. // SCB_BASE->SCR |= SCB_SCR_SEVONPEND; // Set SLEEPONEXIT -Indicates sleep-on-exit when returning from Handler mode to Thread mode - // if enabled, we will effectively sleep from the end of one interrupt till the start of the next. // SCB_BASE->SCR |= SCB_SCR_SLEEPONEXIT; // Now go into stop mode, wake up on interrupt asm(" wfi"); } void runit(){ } void setup() { Serial.begin(115200); delay(1000); pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN,HIGH); } void loop() { Serial.println("loop"); Serial.println(rt.getTime()); delay(1000); rt.createAlarm(runit, rt.getTime() + 5); sleepMode(false); for(int i= 0; i<100;i++) { Serial.print("this prints only zero"); Serial.println(rt.getTime()); } delay(1000); digitalWrite(LED_PIN,!digitalRead(LED_PIN)); }

Арпрос
Ср 24 октября 2018 г. 13:40
Вы не можете получить через USB. USB традиционно поступает в два типа: хост и устройство. Компьютеры - это USB -хосты и такие вещи, как MIDI -устройства, мыши, камеры и т. Д. USB -устройства. Вы обычно не можете соединить два USB -устройства или два USB -хоста вместе. STM32F1 - это USB -устройство. Чтобы подключиться к вашему устройству MIDI, вам нужен USB -хост.
Есть USB -модули хоста, которые вы можете купить, которые вы можете использовать с STM32F1 над SPI. Но я не знаю, есть ли библиотечная поддержка для Миди над ними.

Pareidolialjebus
Ср 24 октября 2018 г. 14:07
[Арпрос - Ср 24 октября 2018 г. 13:40] - Вы не можете получить через USB. USB традиционно поступает в два типа: хост и устройство. Компьютеры - это USB -хосты и такие вещи, как MIDI -устройства, мыши, камеры и т. Д. USB -устройства. Вы обычно не можете соединить два USB -устройства или два USB -хоста вместе. STM32F1 - это USB -устройство. Чтобы подключиться к вашему устройству MIDI, вам нужен USB -хост.
Есть USB -модули хоста, которые вы можете купить, которые вы можете использовать с STM32F1 над SPI. Но я не знаю, есть ли библиотечная поддержка для Миди над ними.
Для ясности: если вы подключите синюю таблетку (устройство) к ПК (хосту), это должно быть хорошо, чтобы * получить данные MIDI *, через USB, с компьютера (а также отправить его на компьютер)?

Арпрос
Ср 24 октября 2018 г. 14:26
[Pareidolialjebus - Ср 24 октября 2018 г. 14:07] - Для ясности: если вы подключите синюю таблетку (устройство) к ПК (хосту), это должно быть хорошо, чтобы * получить данные MIDI *, через USB, с компьютера (а также отправить его на компьютер)?
Да, это должно. В какой-то момент я ожидаю, что протестировал пример MIDIIN в библиотеке USBComposite именно для подключения к компьютеру к STM. Библиотека развилась с тех пор, так что это возможно что -то сломанное.

Вот несколько обсуждений USB -хозяина: http: // stm32duino.com/viewtopic.PHP?f = 9&T = 4172

Мадиас
Ср 24 октября 2018 г., 15:50
Простите, но администратор должен заблокировать эту ветку, Если парень даже не отдает основную информацию о своем проекте, системе, что угодно...

Jackie393
Ср 24 октября 2018 г., 17:35
[Мадиас - Ср 24 октября 2018 г. 15:50] - Простите, но администратор должен заблокировать эту ветку, Если парень даже не отдает основную информацию о своем проекте, системе, что угодно...
Спасибо за поддержку.Извините, мой английский и информация о моем проекте.
Мой проект: DIY USB MIDI DJ Controller для виртуального диджея (программное обеспечение) (Я добился успеха в Arduino Uno R3.
Я могу отправить / получить MIDI -сообщение с виртуальным диджеем. Использовать Uno R3 "Чип Atmega16u2 работает базовое устройство USB MIDI и MIDI Library").
Теперь я хочу получить Midi Message с черной таблеткой от виртуального диджея
"Пример Midi Out Message от Black Pill до виртуального диджея работает" #define BOARD_LED_PIN PC13 #define BKP_REG_BASE (uint32_t *)(0x40006C00 +0x04) // Defined for power and sleep functions pwr.h and scb.h #include #include #define SCB_SCR_SLEEPDEEP 4 // This register bit controls deepsleep(1) or sleep(0) #define SCB_SCR_SLEEPONEXIT 2 // This register bit controls sleeponexit. i.e. do we go back to sleep immediately after serviceing the interrupt, or go back to the main loop. #define SCB_SCR_SEVONPEND 16 // Controls Send Event on Pending bit: #include RTClock rt(RTCSEL_LSE); long int alarmDelay = 15; void setup() { pinMode(BOARD_LED_PIN, OUTPUT); digitalWrite(BOARD_LED_PIN, false); delay(10); digitalWrite(BOARD_LED_PIN, true); time_t nextAlarm = (rt.getTime() + alarmDelay); rt.createAlarm(&AlarmFunction, nextAlarm); sleepMode(true); } void loop() { // We will never get here as the device is always reset when the RTC alarm is triggered and we go to sleep already in the setup() } void AlarmFunction () { // This is not executed either.. } void sleepMode(bool deepSleepFlag) { // Clear PDDS and LPDS bits PWR_BASE->CR &= PWR_CR_LPDS | PWR_CR_PDDS | PWR_CR_CWUF; // Set PDDS and LPDS bits for standby mode, and set Clear WUF flag (required per datasheet): PWR_BASE->CR |= PWR_CR_CWUF; PWR_BASE->CR |= PWR_CR_PDDS; // Enable wakeup pin bit. PWR_BASE->CR |= PWR_CSR_EWUP; // Low-power deepsleep bit. // PWR_BASE->CR |= PWR_CR_LPDS; // System Control Register Bits. See... // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihhjgdh.html if (deepSleepFlag) { // Experimental // Set Power down deepsleep bit. PWR_BASE->CR |= PWR_CR_PDDS; // Unset Low-power deepsleep. PWR_BASE->CR &= ~PWR_CR_LPDS; // Set sleepdeep in the system control register - if set, we deepsleep and coldstart from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; } else { // Unset Power down deepsleep bit. PWR_BASE->CR &= ~PWR_CR_PDDS; // set Low-power deepsleep. PWR_BASE->CR |= PWR_CR_LPDS; /* * PWR_CR_PDDS Power down deepsleep. PWR_CR_LPDS Low-power deepsleep. */ // Unset sleepdeep in the system control register - if not set then we only sleep and can wake from RTC or pin interrupts. SCB_BASE->SCR |= SCB_SCR_SLEEPDEEP; // Low-power deepsleep bit. } // Set end Event on Pending bit: - enabled events and all interrupts, including disabled interrupts, can wakeup the processor. // SCB_BASE->SCR |= SCB_SCR_SEVONPEND; // Set SLEEPONEXIT -Indicates sleep-on-exit when returning from Handler mode to Thread mode - // if enabled, we will effectively sleep from the end of one interrupt till the start of the next. // SCB_BASE->SCR |= SCB_SCR_SLEEPONEXIT; // Now go into stop mode, wake up on interrupt asm(" wfi"); }

Thekikgen
Пн 10 декабря 2018 г., 11:26 утра
Привет.

Проверьте это.

https: // github.com/thekikgen/usbmidikli ... /Readme.доктор медицинских наук