[DEV] STM32G4xx support

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
julester23
Posts: 6
Joined: Sat Jan 04, 2020 5:25 pm
Has thanked: 1 time

Re: [DEV] STM32G4xx support

Postby julester23 » Mon Jan 06, 2020 5:29 pm

Giovanni wrote:- It should be named FDCANv1 as the current rule is that LLDs take the name of the peripheral (CANv1 is historically wrong, it should be BXCANv1).
- The number of RX and TX mailboxes is set to 1, I believe there are more.
- IO macros are not very efficient, it forces the compile to write and/or read the register each time because the volatile attribute, the preferred way is to prepare a variable with all values the do a single write (unless things need to be written is sequence separately which is sometime required). In general I prefer to read/modify/write explicitly.


Thanks for the feedback.
- I was unsure if it would be better to go in the direction of unification (support STM32F and STM32G in a single driver in the future) or separation. If I name everything FDCAN, all the LLD calling functions will then also need to be renamed as well in order to match the filenames, right? So can_lld_tx_handler will be fdcan_lld_tx_handler and then all the higher level interfaces will need to also be rewritten?
- Mailboxes is not a term that is even mentioned for FDCAN, should I kill it in the FDCAN driver? I hadn't figured out how to use the second FIFO. The feature which enables unmatched filter frames to automatically get pushed into a FIFO seemed interesting, however I suppose it's best to leave these choices up to the user. There are two RX FIFOs and a single TX FIFO\Queue (decided with the config register) on the G434. I haven't read the whole series' specs, but I think this holds for most of the series if not all.
- Understood, I went for readability\simplicity, but in this case it sounds worthwhile to consolidate reads\writes.

I'll make some more progress on this, what's the best way to contribute or post updates? I assume git isn't the best, but that's how I'll continue until I hear otherwise.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Mon Jan 06, 2020 5:54 pm

The function names are part of the interface and come from the driver name which is CAN, you can't change those.

There are few things that are named after the peripheral:
- The directory.
- Peripheral-specific macros, for example register definitions.
- Static functions inside the LLD.

Giovanni

julester23
Posts: 6
Joined: Sat Jan 04, 2020 5:25 pm
Has thanked: 1 time

Re: [DEV] STM32G4xx support

Postby julester23 » Wed Jan 08, 2020 7:26 am

I made a few changes most of what you were recommending and also added a missing file. Just committing to my branch on my fork. I invited you to review the pull-request on github in case that would be helpful as a tool for you to give more specific feedback and line-by-line commentary. Let me know what you'd like to see and how to proceed. Do TX event buffers need to be implemented? Or time-stamps? Or just better to focus on testing with more hardware and across it? I should be able to test on the G474 EVAL board in the next few days and make the appropriate updates to the stm32_registry.h file.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Wed Jan 08, 2020 8:13 am

Events are part of the driver interface.

Giovanni

julester23
Posts: 6
Joined: Sat Jan 04, 2020 5:25 pm
Has thanked: 1 time

Re: [DEV] STM32G4xx support

Postby julester23 » Wed Jan 08, 2020 3:59 pm

I wasn't talking about chibi events, the hardware has a tx events buffer which provides things like timestamps and assurances that transmit events did actually occur.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Wed Jan 08, 2020 6:02 pm

I need to study it, I am open to suggestions. Probably TX events could become event flags in the driver.

Giovanni

julester23
Posts: 6
Joined: Sat Jan 04, 2020 5:25 pm
Has thanked: 1 time

Re: [DEV] STM32G4xx support

Postby julester23 » Fri Jan 10, 2020 11:32 pm

I made some improvements to the FDCAN driver to handle multiple peripherals and was able to test it on the EVAL board. Latest branch includes the older work and also the newer here: https://github.com/julienrhodes/ChibiOS ... n_g474eval

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Tue Jan 14, 2020 2:35 pm

ADCv3 has been updated to support G4, ADC5 support is not yet included.

To be tested.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Tue Jan 14, 2020 2:35 pm

julester23 wrote:I made some improvements to the FDCAN driver to handle multiple peripherals and was able to test it on the EVAL board. Latest branch includes the older work and also the newer here: https://github.com/julienrhodes/ChibiOS ... n_g474eval


Thanks, I will switch on this as soon as possible.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [DEV] STM32G4xx support

Postby Giovanni » Sun Feb 16, 2020 8:00 am

ADCv3 is now functional and there is a demo. FDCAN should be next.

Is anybody able to test the USB driver on G4?

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: Google [Bot] and 14 guests