Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analog support for STM32G431 #19922

Closed
1 of 4 tasks
HapiCZ opened this issue Feb 23, 2023 · 8 comments
Closed
1 of 4 tasks

Analog support for STM32G431 #19922

HapiCZ opened this issue Feb 23, 2023 · 8 comments
Labels
enhancement help wanted stale Issues or pull requests that have become inactive without resolution.

Comments

@HapiCZ
Copy link

HapiCZ commented Feb 23, 2023

Feature Request Type

  • Core functionality
  • Add-on hardware support (eg. audio, RGB, OLED screen, etc.)
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

Would it be possible to add support for STM32G431 to analog.c? New keyboards from Deskeys use this chip. It would be possible to install QMK firmware on these keyboards.

@Cipulot
Copy link
Contributor

Cipulot commented Feb 23, 2023

Following this, addition of the ADC support for the brother of the G431, the G474, would be nice. In practice the interesting feature is the internal redirect of ADC outputs to the opamps without utilizing GPIO pins.
First step in the line is for sure the ADC addition and then that can be implemented too. Some work has been shown in the QMK discord a while back.

@HapiCZ
Copy link
Author

HapiCZ commented Mar 1, 2023

I'm trying to figure it out. Although I am a programmer, this is completely new to me. It seems to me that the problem with the STM32G431 and STM32G441 chips is already in ChibiOS itself.

STM32_FLASH_NUMBER_OF_BANKS is set to 2 in the stm32_registry.h. According to the reference manual, these chips have only one bank.

In addition, the compilation includes LLD/ADCv3/hal_adc_lld.h

These two chips, however, only have ADC1 and ADC2.

I don't see how this can be solved without modifying ChibiOS. Can someone verify this? Maybe I'm wrong.

@tzarc
Copy link
Member

tzarc commented Mar 1, 2023

ADCv3 is the 3rd "version" of the ADC API within ChibiOS -- different chips have different APIs and the G4xx is set to use the v3 API. ADC1/ADC2 can thus be considered as peripheral instances that export the ADCv3 API.

For the dual-bank issue it you would likely need to lodge a bug report on the ChibiOS forum at this point.

Not sure what else is involved with the ADCs -- perhaps @Cipulot can link to the discussion directly?

@Cipulot
Copy link
Contributor

Cipulot commented Mar 1, 2023

I was starting to look into the ADCs by myself but then in the last week, sigprof actually started doing some more explicit research and also posted considerations about default settings to implement.

Here's a link for the QMK discord server discussion. It's in the development channel and mixed inbetween other convos but it's all there.

In parallel, in this case mostly because of how I personally implemented the code, some considerations about the use of ATOMIC_BLOCK_FORCEON and interrupts in general were expressed by sigprof.

I think that the 2 could go forward in parallel, even tho that might take a while and will have to "take place" mostly in ChibiOS in the first part, to then move to QMK

@sigprof
Copy link
Contributor

sigprof commented Mar 2, 2023

Analog support for G4xx would probably work with the code that's currently in my adc-stm32l4xx branch (it's just missing the chip-specific piece of code in pinToMux()). Beware that the branch is very likely to be rebased without any warning, and it also contains some unrelated changes in onekeys and the joystick code to make testing easier.

And, BTW, the EFL code for G4xx seems to have another problem — it defines stm32_flash_get_size(), which detects the actual flash size, but then does not use it anywhere, so the reported flash size might not match the real chip.

@Cipulot
Copy link
Contributor

Cipulot commented Mar 23, 2023

@sigprof I just grabbed some hardware that uses the G431. I'll tinker with it a bit and test the implementation of your fork for the L4XX.

Will update along the way with developments.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

@github-actions github-actions bot added the stale Issues or pull requests that have become inactive without resolution. label Jun 22, 2023
@github-actions
Copy link

This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know.
// [stale-action-closed]

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted stale Issues or pull requests that have become inactive without resolution.
Projects
None yet
Development

No branches or pull requests

4 participants