Other Parts Discussed in Thread: SYSBIOS
I'm trying to use the McASP on a BBB. I've been able to build the MCASP_Audio_evmAM335x_armExampleProject for the BBB and get the McASP initialized. I've made all the changes to my project needed based on the sample project but it fails calling mcaspBindDev. Here's the configuration information:
Pinmux info
from bbbAM335x_pinmux.c
/* MCASP */
if(S_PASS == status)
{
status = PINMUXModuleConfig(CHIPDB_MOD_ID_MCASP, 0U, NULL);
}
if(S_PASS == status)
{
status = PINMUXModuleConfig(CHIPDB_MOD_ID_MCASP, 1U, NULL);
}
from am335x_beagleboneblack_pinmux_data.c
static pinmuxPerCfg_t gMcasp0PinCfg[] =
{
{
/* MyMCASP0 -> mcasp0_aclkr -> V2 */
PIN_LCD_DATA12, 0, \
( \
PIN_MODE(3) | \
((PIN_PULL_UD_EN | PIN_RX_ACTIVE) & (~PIN_PULL_TYPE_SEL)) \
) \
},
{
/* MyMCASP0 -> mcasp0_fsr -> V3 */
PIN_LCD_DATA13, 0, \
( \
PIN_MODE(3) | \
((PIN_PULL_UD_EN | PIN_RX_ACTIVE) & (~PIN_PULL_TYPE_SEL)) \
) \
},
{
/* MyMCASP0 -> mcasp0_axr0 -> U3 */
PIN_LCD_DATA10, 0, \
( \
PIN_MODE(3) | \
((PIN_PULL_UD_EN | PIN_RX_ACTIVE) & (~PIN_PULL_TYPE_SEL)) \
) \
},
{
/* MyMCASP0 -> mcasp0_axr1 -> V4 */
PIN_LCD_DATA14, 0, \
( \
PIN_MODE(3) | \
((PIN_PULL_UD_EN | PIN_RX_ACTIVE) & (~PIN_PULL_TYPE_SEL)) \
) \
},
{PINMUX_INVALID_PIN}
};
Config file
/* ================ Driver configuration ================ */
//Load the EDMA package
var drv = xdc.loadPackage ("ti.sdo.edma3.drv");
var Edma = xdc.loadPackage ("ti.sdo.edma3.drv.sample");
var rm = xdc.loadPackage ("ti.sdo.edma3.rm");
var socType = "am335x";
var osType = "tirtos";
/* Load the OSAL package */
var Osal = xdc.useModule('ti.osal.Settings');
Osal.osType = osType;
Osal.socType = socType;
/*use CSL package*/
var Csl = xdc.loadPackage('ti.csl');
Csl.Settings.deviceType = socType;
/* Load Profiling package */
var Utils = xdc.loadPackage('ti.utils.profiling');
/* Load the uart package */
var UartPackage = xdc.loadPackage('ti.drv.uart');
UartPackage.Settings.enableProfiling = true;
UartPackage.Settings.socType = socType;
/* Load the spi package */
var Spi = xdc.loadPackage('ti.drv.spi');
Spi.Settings.socType = socType;
/* Load the driver packages, starting with mcasp */
var McASP = xdc.loadPackage('ti.drv.mcasp');
McASP.Settings.socType = socType;
/* Load the I2C package */
var I2c = xdc.loadPackage('ti.drv.i2c');
I2c.Settings.socType = socType;
/* Load the gpio package */
var GpioPackage = xdc.loadPackage('ti.drv.gpio');
GpioPackage.Settings.enableProfiling = true;
GpioPackage.Settings.socType = socType;
/* Load the board package */
var Board = xdc.loadPackage('ti.board');
Board.Settings.boardName = "bbbAM335x";
/* ================ Cache and MMU configuration ================ */
var Cache = xdc.useModule('ti.sysbios.family.arm.a8.Cache');
Cache.enableCache = true;
var Mmu = xdc.useModule('ti.sysbios.family.arm.a8.Mmu');
Mmu.enableMMU = true;
/* Force peripheral section to be NON cacheable strongly-ordered memory */
var peripheralAttrs = {
type : Mmu.FirstLevelDesc_SECTION, // SECTION descriptor
tex: 0,
bufferable : false, // bufferable
cacheable : false, // cacheable
shareable : false, // shareable
noexecute : true, // not executable
};
Mmu.setFirstLevelDescMeta(0x4ae00000, 0x4ae00000, peripheralAttrs);
/* CM_, PRM_ registers */
Mmu.setFirstLevelDescMeta(0x44E00000, 0x44E00000, peripheralAttrs);
/* edma */
for (var i=0x49000000; i < 0x49100000; i = i + 0x00200000) {
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(i, i, peripheralAttrs);
}
for (var i=0x49800000; i < 0x49B00000; i = i + 0x00200000) {
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(i, i, peripheralAttrs);
}
/* I2C0 */
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(0x44e0b000, 0x44e0b000, peripheralAttrs);
/* I2C1 */
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(0x4802A000, 0x4802A000, peripheralAttrs);
/* I2C2 */
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(0x4819c000, 0x4819c000, peripheralAttrs);
/* GPIO */
/* Configure the corresponding MMU page descriptor accordingly */
Mmu.setFirstLevelDescMeta(0x44e00400, 0x44e00400, peripheralAttrs);
Mmu.setFirstLevelDescMeta(0x481a6000, 0x481a6000, peripheralAttrs);
/* mcasp-0 CFG*/
for (var i=0x48038000; i < 0x4803B000; i = i + 0x00200000) {
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(i, i, peripheralAttrs);
}
/* mcasp-0 DATA */
for (var i=0x46000000; i < 0x46400000; i = i + 0x00200000) {
// Each 'BLOCK' descriptor entry spans a 2MB address range
Mmu.setFirstLevelDescMeta(i, i, peripheralAttrs);
}
I have added mcasp_soc.c to provide the McaspDevice_init() funcion.
Main.c
Int main()
{
Task_Handle task;
Error_Block eb;
Task_Params taskParams;
SPI_Params spiParams; /* SPI params structure */
SPI_Handle handle; /* SPI handle */
if (Board_initUART() == false)
{
System_printf("\nBoard_initUART failed!\n");
return (0);
}
UART_init();
GPIO_init();
McaspDevice_init();
Error_init(&eb);
/* Initialize the task params */
Task_Params_init(&taskParams);
taskParams.stackSize = 0x2000;
Task_create(testMcASP, &taskParams, &eb);
BIOS_start(); /* does not return */
return (0);
}
Void testMcASP()
{
EDMA3_DRV_Result edmaResult = 0;
Mcasp_HwInfo hwInfo;
Mcasp_socGetInitCfg(MCASP_NUM, &hwInfo);
enableEDMAHwEvent(EDMACC_NUM,MCASP_RX_DMA_CH);
enableEDMAHwEvent(EDMACC_NUM,MCASP_TX_DMA_CH);
hwInfo.dmaHandle = edma3init(0, &edmaResult);
/* McASP Device handles */
Ptr hMcaspDev;
/* McASP Device parameters */
Mcasp_Params mcaspParams;
/* Channel Handles */
Ptr hMcaspTxChan;
Ptr hMcaspRxChan;
Mcasp_socSetInitCfg(MCASP_NUM, &hwInfo);
mcaspParams = Mcasp_PARAMS;
//configure the McASP to get IMU data
int status = mcaspBindDev(&hMcaspDev, MCASP_NUM, &mcaspParams); <--- This call fails
/* Create Mcasp channel for Rx */
status = mcaspCreateChan(&hMcaspRxChan, hMcaspDev, MCASP_INPUT,
&mcasp_chanparam[0], mcaspAppCallback, NULL);
MCASP_Packet rxFrame;
char data[EXPECTED_IMU_LENGTH];
/* Issue an empty buffer to the input stream */
rxFrame.cmd = MCASP_READ;
rxFrame.addr = (void*) data;
rxFrame.size = EXPECTED_IMU_LENGTH;
rxFrame.arg = (uintptr_t) hMcaspRxChan;
rxFrame.status = 0;
rxFrame.misc = 1; /* reserved - used in callback to indicate asynch packet */
status = mcaspSubmitChan(hMcaspRxChan, &rxFrame);
//if((status != MCASP_PENDING))
}
Stepping into the call I found that it's failing when trying to reset the McASP device on the line that writes to the config register
Debug output
[CortxA8] 0x48038000 R8 = 0x00000001
R1 = 0x80044318 R9 = 0x00000001
R2 = 0x000006ba R10 = 0x81257428
R3 = 0x00000000 R11 = 0x81058c84
R4 = 0x812576e4 R12 = 0x81058c88
R5 = 0x81257428 SP(R13) = 0x81058c68
R6 = 0x81257430 LR(R14) = 0x8002b398
R7 = 0x00000000 PC(R15) = 0x800350d8
PSR = 0x6000019f
DFSR = 0x00001808 IFSR = 0x00000000
DFAR = 0x48038044 IFAR = 0x00000000
ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0x800350d8, lr = 0x8002b398.
xdc.runtime.Error.raise: terminating execution
When I run the sample application this succeeds. I've gone through my app and the sample app line by line and cant figure out what I'm missing. Any help would be appreciated!