bjsowa / stm32-midi-piano

6 stars 3 forks source link

Need help #1

Open 4dvn opened 4 years ago

4dvn commented 4 years ago

Can you upload the schematic and how to upload code for stm32f103c8t6 bluepill? I want to make 16 buttons from note 36 to 51 can you give me the code of that?

bjsowa commented 4 years ago

I'm glad someone took interest in my project. Unfortunately, I stopped development at some point, but want to continue it in the near future.

I used BlackPill board (F1), so I'm not sure if everything will work correctly on bluepill, but since they use the same MCU, there's a high chance it will.

To upload the code, I used PlatformIO IDE and ST-Link programmer.

If you manage to successfully flash the bluepill board, and it registers as a MIDI device, I can provide the schematics and help you modify the code for your needs.

4dvn commented 4 years ago

I'm glad someone took interest in my project. Unfortunately, I stopped development at some point, but want to continue it in the near future.

I used BlackPill board (F1), so I'm not sure if everything will work correctly on bluepill, but since they use the same MCU, there's a high chance it will.

To upload the code, I used PlatformIO IDE and ST-Link programmer.

If you manage to successfully flash the bluepill board, and it registers as a MIDI device, I can provide the schematics and help you modify the code for your needs.

Thank you for reply, can you tell me which part need to modify for my buttons request ( 16 buttons ) also i need schematic for testing thank you!

bjsowa commented 4 years ago

Here's a schematic you can try image

bjsowa commented 4 years ago

For code editing, you should look at the main.c file. In particular, the gpio_setup() and sys_tick_handler() functions, and these lines:

static bool key_states[8];
static uint8_t key_number[8] = { 44, 45, 46, 47, 48, 49, 50, 51 };
static uint16_t key_gpio[8]
    = { GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7 };
static uint16_t key_gpios;

The code assumes all buttons are connected to GPIO Port A. If you need to use buttons connected to other GPIO ports or use a scan matrix, you will need to write some more logic in the code which I did not have time to add.

4dvn commented 4 years ago

I'll buy blackpill and some potentiomters and diodeimage I really want to move from arduino uno to stm32 for faster midi communication, hope you can help to finish it 😫

bjsowa commented 4 years ago

What's wrong with bluepill ?

4dvn commented 4 years ago

What's wrong with bluepill ?

I create a new project with bluepill and import your code to compile it but when upload hex via stm utility done the usb midi driver show error on board