NuttX on a Netduino Plus 2; mapping pins

Today consists of mundane chores.  I notice a new release just came out, 6.28, so I pull that and merge in my changes.  Fortunately, everything I have done is in an added directory, and also fortunate is that it builds and works.  This took a couple hours for me, because I am fastidious about testing the buildability at each step.  But what really took up the day was mapping out the IO for the peripherals.

This mapping step is necessary because the board setup code has to specify how the on-chip peripherals connect to the pins — there’s several choices.  Also, the task is made worse from nomenclature clash — from the user’s perspective they are named one way (e.g. D0-D7, COM4, A0, etc), and the pins have different names in the CPU.  Moreover, abstract peripherals like ‘the sd card’, ‘the ethernet controller’, ‘the COM1 port’, need to be translated to what CPU resource they are using, like ‘spi3’, ‘spi1’, or ‘usart6’.

So, I sit down with schematic, datasheet, and ‘arch/arm/src/stm32/chip/stm32f40xxx_pinmap.h’, and correlate all the things.

Another concern I have looking forward is that most of the pins on the netduino header serve alternate functions, depending on the user application deployed.  For example D3 could be any of: a digital IO, TX of COM2, or a PWM output.  On the other hand, most embedded systems are single-function, and a board initialization routine will set those choices once and for all.  So I don’t know if I will later run into challenges whereby I need to change the IO functionality later, on-the-fly.  We’ll see.  For my first step, I will try to get drivers working for the dedicated off-chip hardware, namely:  the SD card, the ENC38J60 Ethernet controller.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s