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

[BUG] Undefined GPIO Constants (GPIO_SSI1_CLK, GPIO_SSI1_RX, GPIO_SSI1_TX) in tiva_ssi.c on TM4C123G #14690

Open
1 task done
angelorisonk opened this issue Nov 7, 2024 · 5 comments
Labels
Arch: arm Issues related to ARM (32-bit) architecture OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@angelorisonk
Copy link

angelorisonk commented Nov 7, 2024

Screenshot from 2024-11-07 19-17-09

Description / Steps to reproduce the issue

When enabling SSI1 on the Tiva TM4C123G board in NuttX, the following errors occur during the build:

  1. GPIO_SSI1_CLK, GPIO_SSI1_RX, and GPIO_SSI1_TX are reported as undeclared identifiers in tiva_ssi.c.
  2. The build fails as a result of these undefined constants, even though similar constants (e.g., GPIO_SSI3_CLK) are available.

Steps to reproduce:

  1. Configure the NuttX project for the Tiva TM4C123G board.
  2. Enable SSI1 through make menuconfig:
    • Navigate to Device Drivers > SPI Support > Enable SSI1
  3. Build the project with make -j$(nproc).
  4. Observe the compilation errors related to the undefined GPIO_SSI1_CLK, GPIO_SSI1_RX, and GPIO_SSI1_TX.

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Linux Mint 22

NuttX Version

master

Issue Architecture

[Arch: arm]

Issue Area

[Area: Other]

Verification

  • I have verified before submitting the report.
@angelorisonk angelorisonk added the Type: Bug Something isn't working label Nov 7, 2024
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture OS: Linux Issues related to Linux (building system, etc) labels Nov 7, 2024
@acassis
Copy link
Contributor

acassis commented Nov 7, 2024

Hi @angelorisonk please look how it is implemented for SSI3 at boards/arm/tiva/dk-tm4c129x/include/board.h

Then look at arch/arm/src/tiva/hardware/tm4c/tm4c_pinmap.h to associate the right GPIO_SSI1_CLK_x GPIO_SSI1_RX_x and GPIO_SSI1_TX_x symbol with the GPIO pin you are using.

@hartmannathan since you are more familiar with this chip, is there any other thing to observe?

@hartmannathan
Copy link
Contributor

Hi @angelorisonk please look how it is implemented for SSI3 at boards/arm/tiva/dk-tm4c129x/include/board.h

Then look at arch/arm/src/tiva/hardware/tm4c/tm4c_pinmap.h to associate the right GPIO_SSI1_CLK_x GPIO_SSI1_RX_x and GPIO_SSI1_TX_x symbol with the GPIO pin you are using.

@hartmannathan since you are more familiar with this chip, is there any other thing to observe?

@acassis I'm writing this from my phone right now but if there is still a problem I can look into it more carefully tomorrow. I think you are correct: when the chip can map a signal to alternative pins, the board needs to choose which one to use by providing the define. For example:

#define GPIO_SSI1_CLK GPIO_SSI1_CLK_1

Obviously you need to use the correct mapping. To see which pin GPIO_SSI1_CLK_1 maps to, grep for that name in the arch/arm subtree.

@angelorisonk
Copy link
Author

@hartmannathan Thank you for your suggestion. However, after adding the lines you recommended, I am still encountering the same issue. I have spent several hours debugging, but the problem persists, and I can't seem to identify the root cause. Any further guidance or insights would be greatly appreciated.

@acassis
Copy link
Contributor

acassis commented Nov 8, 2024

@angelorisonk please run a "git diff" to show the lines you added. As I said you need to look at the pinmap header file at arch/ and create the definitions at boards/..../include/board.h point to each pin:

#define GPIO_SSI1_CLK GPIO_SSI1_CLK_x
#define GPIO_SSI1_RX GPIO_SSI1_RX_y
#define GPIO_SSI1_TX GPIO_SSI1_TX_z

Just fix x, y and z according to pinmap symbol to the right pin you are using in your board.

@hartmannathan
Copy link
Contributor

@hartmannathan Thank you for your suggestion. However, after adding the lines you recommended, I am still encountering the same issue. I have spent several hours debugging, but the problem persists, and I can't seem to identify the root cause. Any further guidance or insights would be greatly appreciated.

In your board's include/board.h file, you need to define GPIO_SSI1_CLK, GPIO_SSI1_RX, and GPIO_SSI1_TX.

GPIO_SSI1_CLK can be defined in one of the following two ways:

If your board has the SSI1 CLK routed to pin PD0:

#define GPIO_SSI1_CLK GPIO_SSI1_CLK_1

or, if your board has SSI1 CLK routed to pin PF2:

#define GPIO_SSI1_CLK GPIO_SSI1_CLK_2

The same goes for GPIO_SSI1_RX, and GPIO_SSI1_TX, with GPIO_SSI1_RX defined either to GPIO_SSI1_RX_1 (PD2) or GPIO_SSI1_RX_2 (PF0), and with GPIO_SSI1_TX defined either to GPIO_SSI1_TX_1 (PD3) or GPIO_SSI1_TX_2 (PF1).

How do you know which pin the _1 suffix or _2 suffix will use? These definitions are in nuttx/arch/arm/src/tiva/hardware/tm4c/tm4c_pinmap.h, around line 245

#  define GPIO_SSI1_CLK_1      (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTD | GPIO_PIN_0)
#  define GPIO_SSI1_CLK_2      (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTF | GPIO_PIN_2)
#  define GPIO_SSI1_FSS_1      (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTD | GPIO_PIN_1)
#  define GPIO_SSI1_FSS_2      (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTF | GPIO_PIN_3)
#  define GPIO_SSI1_RX_1       (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTD | GPIO_PIN_2)
#  define GPIO_SSI1_RX_2       (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTF | GPIO_PIN_0)
#  define GPIO_SSI1_TX_1       (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTD | GPIO_PIN_3)
#  define GPIO_SSI1_TX_2       (GPIO_FUNC_PFIO     | GPIO_ALT_2  | GPIO_PORTF | GPIO_PIN_1)

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants