I’m develloping a bare metal application for BBB. Everything seems to work perfectly, but I can’t seem to get any SPI_CLK signals on the pins.
I literally read the Technical Reference Manual (sections PCRM, control and McSPI) of the AM3358 multiple times, and I can’t figure out why I don’t measure any signal on my pins.
I can write to the SPI registers, so the interface clock is working.
The functional clock doesn’t seem to work/be connected to the pin.
My main code:
#include “soc_AM335x.h”
#include “beaglebone.h”
#include “gpio_v2.h”
#include “mcspi.h”
/*****************************************************************************
** INTERNAL MACRO DEFINITIONS
*****************************************************************************/
#define GPIO_INSTANCE_ADDRESS (SOC_GPIO_1_REGS)
#define GPIO_INSTANCE_PIN_NUMBER (23)
/*****************************************************************************
** INTERNAL FUNCTION PROTOTYPES
*****************************************************************************/
static void Delay(unsigned int count);
/*****************************************************************************
** INTERNAL FUNCTION DEFINITIONS
****************************************************************************/
/
** The main function. Application starts here.
*/
int main()
{
//Initialise UARTconsole
UARTConsoleInit();
UARTConsolePutc(“Ready”);
//Klok voor McSPI peripheral aanzetten
McSPI0ModuleClkConfig();
//Pin mux voor SPI_CLK, SPI_D0, SPI_D1 aanzetten
McSPI0PinMuxSetup();
//Pin mux voor CS aanzetten
McSPI0CSPinMuxSetup();
//McSPI lokale reset
McSPIReset(SOC_SPI_0_REGS);
//McSPI instellen van 4-pin mode(CLK, D0, D1, CS)
McSPICSEnable(SOC_SPI_0_REGS);
//McSPI aanzetten in Master mode
McSPIMasterModeEnable(SOC_SPI_0_REGS);
/*
- To configure Single/Multi channel mode, transmit/receive modes and settings for IS, DPE0, DPE1 can be done by
- using the McSPIMasterModeConfig() API. The settings for IS, DPE0 and DPE1 will configure the direction for
- SPID0 and SPID1 pins as input or output. Please refer to the schematics to verify the SPI data pin connections
- and do the setting accordingly. This API will return “FALSE” if an invalid configuration is done for IS,DPE0 and
- DPE1 pins which the McSPI controller cannot process.
*/
McSPIMasterModeConfig(SOC_SPI_0_REGS,MCSPI_MULTI_CH,
MCSPI_TX_RX_MODE,
MCSPI_DATA_LINE_COMM_MODE_0,
MCSPI_CHANNEL_0
);
//Klok instellen
McSPIClkConfig(SOC_SPI_0_REGS,
48000000,
48000000,
MCSPI_CHANNEL_0,
MCSPI_CLK_MODE_0
);
//McSPI word length is configured using the McSPIWordLengthSet() API
McSPIWordLengthSet(SOC_SPI_0_REGS,MCSPI_WORD_LENGTH(8),MCSPI_CHANNEL_0);
//aanzetten juiste McSPI kanaal
McSPIChannelEnable(SOC_SPI_0_REGS,MCSPI_CHANNEL_0);
while(1)
{
UARTConsolePutc(‘i’);
Delay(0x3FFFF);
}
}
/*
** A function which is used to generate a delay.
*/
static void Delay(volatile unsigned int count)
{
while(count–);
}