You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Nathan Hartman <ha...@gmail.com> on 2020/05/06 00:15:45 UTC

Re: Adding support for STM32G474RET6

On Sun, Apr 19, 2020 at 12:03 AM Nathan Hartman
<ha...@gmail.com> wrote:
> I've begun work on supporting the STM32G474RET6, and also the
> B-G474E-DPOW1 Discovery board.

Just FYI, I've been working on adding support for the STM32G474 family
and B-G474E-DPOW1 development board. So far, I have cranked out quite
a bit of code. It's not complete yet but each day I'm getting closer
to the point of building and testing on hardware. At this time, I'm
working on the initialization and bring-up and I've just finished the
initial (so far untested) implementation of the RCC reset and init.

If you'd like a sneak peek at what will eventually be a PR, it's in my
NuttX fork, in the branch stm32g474-squash, which I've squashed so
that you can see all the changes in one commit:

https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474-squash

If you want to see the unsquashed version with some 50 commits so far,
it's in my stm32g474 branch (without the -squash suffix).

If anyone would like to join me in this effort and split the work, I'd
appreciate that very much!!

Cheers,
Nathan

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Wed, May 13, 2020 at 12:26 PM Gregory Nutt <sp...@gmail.com> wrote:

>
> > If all goes well, there will be a big pull request coming soon. Wish me
> luck!
>
> I think we should consider getting a review team together.  This will be
> more than a single person can review (especially if that single person
> is me since I am completely out of touch with with STM32 these days).
> Can we have 3 or 4 volunteers who can perform the review:  David
> Sidrane? Mateusz Szafoni? Matias N.? Alan? Others?
>
> My personal preference would be stand out of the way and let a team of
> experts do the review and merge.  I get overwhelmed with large changes
> that I don't understand and usually just commit them blindly.  Not a
> good way to run a business.


I would appreciate that. In fact my intention was to request that several
people review it, since there are about 7000 lines of changes and new code,
and a bunch of new files.

If needed, it can be broken down into smaller PRs, but that's something I'd
like to talk to the reviewers about, to do it however works best for
everyone.

Thanks,
Nathan

RE: Adding support for STM32G474RET6

Posted by David Sidrane <Da...@nscdg.com>.
Hi

I would be happy to review this, but I will need some time as I am swapped.

David

-----Original Message-----
From: Gregory Nutt [mailto:spudaneco@gmail.com]
Sent: Wednesday, May 13, 2020 9:27 AM
To: dev@nuttx.apache.org
Subject: Re: Adding support for STM32G474RET6


> If all goes well, there will be a big pull request coming soon. Wish me
> luck!

I think we should consider getting a review team together.  This will be
more than a single person can review (especially if that single person
is me since I am completely out of touch with with STM32 these days).
Can we have 3 or 4 volunteers who can perform the review:  David
Sidrane? Mateusz Szafoni? Matias N.? Alan? Others?

My personal preference would be stand out of the way and let a team of
experts do the review and merge.  I get overwhelmed with large changes
that I don't understand and usually just commit them blindly.  Not a
good way to run a business.

Greg

Re: Adding support for STM32G474RET6

Posted by Gregory Nutt <sp...@gmail.com>.
> If all goes well, there will be a big pull request coming soon. Wish me luck!

I think we should consider getting a review team together.  This will be 
more than a single person can review (especially if that single person 
is me since I am completely out of touch with with STM32 these days).  
Can we have 3 or 4 volunteers who can perform the review:  David 
Sidrane? Mateusz Szafoni? Matias N.? Alan? Others?

My personal preference would be stand out of the way and let a team of 
experts do the review and merge.  I get overwhelmed with large changes 
that I don't understand and usually just commit them blindly.  Not a 
good way to run a business.

Greg



Re: Adding support for STM32G474RET6

Posted by Jussi Kivilinna <ju...@haltian.com>.
Hello,

STM32L4R also has DMAMUX with two DMAx controllers. Maybe it is closer match for STM32G4 than H7.

Check:
 https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/stm32l4/stm32l4xrxx_dma.c
 https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dmamux.h

-Jussi

On 7.5.2020 8.25, raiden00pl . wrote:
> You can look how DMAMUX is implemented for stm32h7.
> It's more complicated than in G4 and H7 is based on DMA IPv2 but the
> concept should be the same.
> I got my NUCLEO-G431RB so I can help.
> 
> czw., 7 maj 2020 o 00:15 Nathan Hartman <ha...@gmail.com>
> napisał(a):
> 
>> On Wed, May 6, 2020 at 6:10 PM Nathan Hartman <ha...@gmail.com>
>> wrote:
>>> On Wed, May 6, 2020 at 4:56 PM Gregory Nutt <sp...@gmail.com> wrote:
>>>>> In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
>>>>> channel mappings of the form:
>>>>>
>>>>> #  define DMACHAN_ADC1            STM32_DMA1_CHAN1
>>>>>
>>>>> for the (new) case of CONFIG_STM32_STM32G47XX.
>>>>>
>>>>> How / where can I find the names and values that should be defined?
>>>>
>>>> Probably in the data sheet rather that the user manual
>>>
>>> I am beginning to see what's going on here, but I don't claim to
>>> understand how this works yet.
>>
>> Oh, I forgot to say, the datasheet contains almost nothing. The
>> information seems to be in the Reference Manual after all (though I
>> didn't see it earlier because I was looking for a table of peripherals
>> to DMA channels, like you'd expect to find on most MCUs). The
>> reference manual is RM0440 Rev 2, and it's in Table 81 (pages 383-384)
>> where it seems that each peripheral DMA source/destination has a
>> decimal number from 1 to 115, representing the DMAMUX input request
>> number.
>>
>> Nathan
>>
> 

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Thu, May 14, 2020 at 5:21 PM Nathan Hartman <ha...@gmail.com> wrote:
> It is now time to open a PR and start the review process.

The PR is #1051:
https://github.com/apache/incubator-nuttx/pull/1051

Alan and David, whenever you get the chance, I'll be standing by to
address any issues you find...

Thanks!
Nathan

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
BIG UPDATE: The board boots NuttX to a working NSH prompt!

This means that a whole lot of things went right.

It is now time to open a PR and start the review process.

I'm going to title the PR [DO NOT MERGE] until we go through it...

Greg, thanks for your help. David and Alan, thanks for volunteering to
help review. Of course, anyone else interested is welcome to help!

Cheers,
Nathan

Re: Adding support for STM32G474RET6

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
I with you good luck! Welcome STM32G4!

On 5/13/20, Nathan Hartman <ha...@gmail.com> wrote:
> Update: It builds! It links! After much work, it's time to begin testing...
>
> https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474
>
> If all goes well, there will be a big pull request coming soon. Wish me
> luck!
>
> Nathan
>

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
Update: It builds! It links! After much work, it's time to begin testing...

https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474

If all goes well, there will be a big pull request coming soon. Wish me luck!

Nathan

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
Progress report on this port: I'm getting closer... Not quite
compiling yet, still some errors with a few undefined register
definitions here and there. But I'm definitely getting closer...

As before, my work is in my fork under stm32g474 branch [1], if anyone
wants a sneak preview. :-)

[1] https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474

Nathan

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Thu, May 7, 2020 at 1:18 PM raiden00pl . <ra...@gmail.com> wrote:
> A new branch is a good idea, but I think we should squash as many commits
> as possible before PRs to
> avoid noise in the git history. Especially when it comes to new chip
> specific files.

Agreed. I was thinking to squash the chip support into one commit, and
squash each board support into one commit.

But, I would like to get the code to build and startup to a NSH
prompt. It is easy to squash everything later, but in case of problems
during development, I like having a history of what actually
happened...

Now, the question is, how do I open a PR that creates the stm32g4
branch on the main NuttX repository and puts there the work I've done
so far?

Nathan

Re: Adding support for STM32G474RET6

Posted by "raiden00pl ." <ra...@gmail.com>.
> STM32L4R also has DMAMUX with two DMAx controllers. Maybe it is closer
match for STM32G4 than H7.

Yes, you are right. STM32L4R is definitely a better choice.

> Can we put my stm32g474 branch into the main NuttX repository (as a
> branch, not in master) and split the work? I have ~50 commits and
> ~7000 lines so far. I think it will be better to create a branch
> called "stm32g4" and send smaller manageable PRs to it, instead of
> waiting for one huge PR at the end.

A new branch is a good idea, but I think we should squash as many commits
as possible before PRs to
avoid noise in the git history. Especially when it comes to new chip
specific files.

czw., 7 maj 2020 o 16:20 Nathan Hartman <ha...@gmail.com>
napisał(a):

> On Thu, May 7, 2020 at 1:25 AM raiden00pl . <ra...@gmail.com> wrote:
> > I got my NUCLEO-G431RB so I can help.
>
> How shall we proceed?
>
> Can we put my stm32g474 branch into the main NuttX repository (as a
> branch, not in master) and split the work? I have ~50 commits and
> ~7000 lines so far. I think it will be better to create a branch
> called "stm32g4" and send smaller manageable PRs to it, instead of
> waiting for one huge PR at the end.
>
> https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474
>
> Cheers,
> Nathan
>

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Thu, May 7, 2020 at 1:25 AM raiden00pl . <ra...@gmail.com> wrote:
> I got my NUCLEO-G431RB so I can help.

How shall we proceed?

Can we put my stm32g474 branch into the main NuttX repository (as a
branch, not in master) and split the work? I have ~50 commits and
~7000 lines so far. I think it will be better to create a branch
called "stm32g4" and send smaller manageable PRs to it, instead of
waiting for one huge PR at the end.

https://github.com/hartmannathan/incubator-nuttx/tree/stm32g474

Cheers,
Nathan

Re: Adding support for STM32G474RET6

Posted by "raiden00pl ." <ra...@gmail.com>.
You can look how DMAMUX is implemented for stm32h7.
It's more complicated than in G4 and H7 is based on DMA IPv2 but the
concept should be the same.
I got my NUCLEO-G431RB so I can help.

czw., 7 maj 2020 o 00:15 Nathan Hartman <ha...@gmail.com>
napisał(a):

> On Wed, May 6, 2020 at 6:10 PM Nathan Hartman <ha...@gmail.com>
> wrote:
> > On Wed, May 6, 2020 at 4:56 PM Gregory Nutt <sp...@gmail.com> wrote:
> > > > In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
> > > > channel mappings of the form:
> > > >
> > > > #  define DMACHAN_ADC1            STM32_DMA1_CHAN1
> > > >
> > > > for the (new) case of CONFIG_STM32_STM32G47XX.
> > > >
> > > > How / where can I find the names and values that should be defined?
> > >
> > > Probably in the data sheet rather that the user manual
> >
> > I am beginning to see what's going on here, but I don't claim to
> > understand how this works yet.
>
> Oh, I forgot to say, the datasheet contains almost nothing. The
> information seems to be in the Reference Manual after all (though I
> didn't see it earlier because I was looking for a table of peripherals
> to DMA channels, like you'd expect to find on most MCUs). The
> reference manual is RM0440 Rev 2, and it's in Table 81 (pages 383-384)
> where it seems that each peripheral DMA source/destination has a
> decimal number from 1 to 115, representing the DMAMUX input request
> number.
>
> Nathan
>

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Wed, May 6, 2020 at 6:10 PM Nathan Hartman <ha...@gmail.com> wrote:
> On Wed, May 6, 2020 at 4:56 PM Gregory Nutt <sp...@gmail.com> wrote:
> > > In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
> > > channel mappings of the form:
> > >
> > > #  define DMACHAN_ADC1            STM32_DMA1_CHAN1
> > >
> > > for the (new) case of CONFIG_STM32_STM32G47XX.
> > >
> > > How / where can I find the names and values that should be defined?
> >
> > Probably in the data sheet rather that the user manual
>
> I am beginning to see what's going on here, but I don't claim to
> understand how this works yet.

Oh, I forgot to say, the datasheet contains almost nothing. The
information seems to be in the Reference Manual after all (though I
didn't see it earlier because I was looking for a table of peripherals
to DMA channels, like you'd expect to find on most MCUs). The
reference manual is RM0440 Rev 2, and it's in Table 81 (pages 383-384)
where it seems that each peripheral DMA source/destination has a
decimal number from 1 to 115, representing the DMAMUX input request
number.

Nathan

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
On Wed, May 6, 2020 at 4:56 PM Gregory Nutt <sp...@gmail.com> wrote:
> > In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
> > channel mappings of the form:
> >
> > #  define DMACHAN_ADC1            STM32_DMA1_CHAN1
> >
> > for the (new) case of CONFIG_STM32_STM32G47XX.
> >
> > How / where can I find the names and values that should be defined?
>
> Probably in the data sheet rather that the user manual

I am beginning to see what's going on here, but I don't claim to
understand how this works yet. The STM32G474 has two DMA controllers,
DMA1 and DMA2, and a separate thing called DMAMUX that sits in front
of them and routes DMA requests between peripherals and the DMA
controllers. And I think that unlike another part, say STM32F334 for
example, which has a fixed mapping from peripherals to a particular
DMA channel number, on the STM32G474 it looks like the routing is
selected by the DMAMUX based on what's going on at that moment. They
say the chip has 115 DMA request lines!

Part of the reason for my interest in this chip is that it has a lot
of exotic stuff like this, that should make it possible to squeeze a
lot of performance out!

But I think this is a problem for another day. Right now, I am trying
to get my code to build, so that I can start testing the initial
stages of the bring-up logic. DMA will be important, later.

Nathan

Re: Adding support for STM32G474RET6

Posted by Gregory Nutt <sp...@gmail.com>.
> In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
> channel mappings of the form:
>
> #  define DMACHAN_ADC1            STM32_DMA1_CHAN1
>
> for the (new) case of CONFIG_STM32_STM32G47XX.
>
> How / where can I find the names and values that should be defined?
Probably in the data sheet rather that the user manual

Re: Adding support for STM32G474RET6

Posted by Nathan Hartman <ha...@gmail.com>.
In arch/arm/src/stm32/hardware/stm32_dma_v1.h, I have to add DMA
channel mappings of the form:

#  define DMACHAN_ADC1            STM32_DMA1_CHAN1

for the (new) case of CONFIG_STM32_STM32G47XX.

How / where can I find the names and values that should be defined?

Thanks,
Nathan