Skip to content

Conversation

@rajul-bhambay
Copy link
Collaborator

@rajul-bhambay rajul-bhambay commented Apr 17, 2025

User description

  • Firmware changes
  • Application changes
  • Restructured driver apis

Fixes: PINDSW-8487


PR Type

Enhancement


Description

• Complete PRU I2S driver implementation with comprehensive API for initialization, open/close, read/write operations
• Support for both I2S and TDM4 modes with interleaved/non-interleaved data format conversion
• PRU firmware binaries and assembly code for both TX and RX operations on PRU0 and PRU1
• Interrupt handling with callback mechanisms for Tx, Rx, and error events
• Hardware abstraction layer for PRU firmware loading, ICSS INTC configuration, and GPIO setup
• Diagnostic application with FreeRTOS support for AM263X and AM261X platforms
• TCA6416 IO expander driver for hardware configuration
• Build system integration with makefiles, linker scripts, and project configurations
• Runtime Object View (ROV) configuration for debugging support


Diagram Walkthrough

flowchart LR
  A["PRU I2S Driver"] --> B["I2S Firmware"]
  A --> C["TDM4 Firmware"]
  B --> D["PRU0 TX Binary"]
  B --> E["PRU1 RX Binary"]
  C --> F["PRU0 TDM TX Binary"]
  C --> G["PRU1 TDM RX Binary"]
  A --> H["Diagnostic App"]
  H --> I["AM263X Platform"]
  H --> J["AM261X Platform"]
  H --> K["TCA6416 IO Expander"]
  A --> L["PRUSS INTC Mapping"]
  A --> M["Hardware Abstraction"]
Loading

File Walkthrough

Relevant files
Enhancement
20 files
pru_i2s_drv.c
Complete PRU I2S driver implementation with hardware abstraction

source/pru_i2s/driver/pru_i2s_drv.c

• Complete PRU I2S driver implementation with initialization,
open/close, read/write operations
• Support for both interleaved and
non-interleaved data formats with conversion functions
• Interrupt
handling for Tx, Rx, and error events with callback mechanisms

Hardware abstraction for PRU firmware loading, ICSS INTC
configuration, and GPIO setup

+2379/-0
main.c
FreeRTOS main application for AM263x PRU I2S diagnostic   

examples/pru_i2s_diagnostic/single_channel/am263x-cc/r5fss0-0_freertos/main.c

• FreeRTOS main application entry point for AM263x platform
• Task
creation and scheduler initialization for PRU I2S diagnostic example

System and board initialization with proper task stack allocation

+84/-0   
pru_i2s_drv.h
PRU I2S Driver Header Implementation                                         

source/pru_i2s/include/pru_i2s_drv.h

• Complete PRU I2S driver header file with comprehensive API
definitions
• Defines data structures for configuration, parameters,
and I/O buffers
• Includes function declarations for driver
initialization, open/close, read/write operations
• Contains
hardware-specific constants and register definitions for AM263X and
AM261X SoCs

+1053/-0
pru_i2s_diagnostic.c
PRU I2S Diagnostic Application Implementation                       

examples/pru_i2s_diagnostic/pru_i2s_diagnostic.c

• Complete diagnostic application for PRU I2S functionality testing

Implements Tx/Rx interrupt handlers with error handling and statistics
tracking
• Supports both TDM and I2S modes with configurable firmware
selection
• Includes I2C IO expander configuration for AM263X hardware
setup

+679/-0 
icss_pru_i2s_fw.h
TDM4 Firmware Register Definitions                                             

source/pru_i2s/firmware/TDM4/icss_pru_i2s_fw.h

• Firmware register definitions and bit field mappings for TDM4 mode

Defines register offsets, addresses, and bit field masks for PRU I2S
firmware
• Includes ping-pong buffer control and error status register
definitions

+197/-0 
icss_pru_i2s_fw.h
I2S Firmware Register Definitions                                               

source/pru_i2s/firmware/I2S/icss_pru_i2s_fw.h

• Firmware register definitions and bit field mappings for standard
I2S mode
• Identical structure to TDM4 version with same register
layout and definitions
• Provides firmware interface constants for I2S
protocol implementation

+197/-0 
ioexp_tca6416.c
TCA6416 IO Expander Driver Implementation                               

examples/pru_i2s_diagnostic/board/ioexp_tca6416.c

• I2C IO expander driver implementation for TCA6416 chip
• Provides
functions for opening, configuring, and controlling GPIO pins

Includes I2C transaction handling and register read/write operations

+287/-0 
pru_i2s_interface.h
New I2S firmware interface header with pin configurations

source/pru_i2s/firmware/I2S/pru_i2s_interface.h

• Added new assembly header file defining I2S interface constants and
pin configurations
• Includes conditional compilation for different
SoCs (AM263X, AM261X) and PRU instances
• Defines pin mappings, buffer
addresses, error positions, and interrupt event numbers
• Contains
configuration for both TX and RX I2S instances with different pin
assignments

+213/-0 
pru_i2s_interface.h
New TDM4 firmware interface header with TDM-specific configurations

source/pru_i2s/firmware/TDM4/pru_i2s_interface.h

• Added TDM4 variant of I2S interface header with similar structure to
I2S version
• Includes same SoC and PRU conditional compilation
support
• Defines TDM-specific constants like TDM_CHANNELS and
MAX_TDM_CHANNELS
• Contains different BYTES_TO_LOAD value (2) and
samples per channel (16) for TDM mode

+209/-0 
data.h
I2S diagnostic example data definitions and buffer configurations

examples/pru_i2s_diagnostic/data.h

• Added comprehensive data definitions for I2S diagnostic example

Defines buffer sizes, constants for audio processing, and error
handling
• Includes ping-pong buffer configurations and memory layout
definitions
• Contains pre-initialized TX buffer data with test
patterns

+99/-0   
ioexp_tca6416.h
TCA6416 IO expander driver header with complete API           

examples/pru_i2s_diagnostic/board/ioexp_tca6416.h

• Added complete TCA6416 IO expander driver header file
• Defines API
functions for opening, configuring, and controlling IO expander

Includes data structures for configuration parameters and attributes

Provides constants for input/output modes and pin states

+210/-0 
pru_i2s_tdm4_pru0_array.h
PRU0 TDM4 firmware binary array                                                   

source/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru0_array.h

• Added compiled PRU0 firmware binary array for TDM4 mode
• Contains
both instruction array (pru_prupru_i2s0_image_0_0) and data array

Provides pre-compiled firmware ready for loading into PRU0

+191/-0 
pru_i2s_pru0_array.h
PRU0 I2S firmware binary array                                                     

source/pru_i2s/firmware/I2S/pru_i2s_pru0_array.h

• Added compiled PRU0 firmware binary array for standard I2S mode

Contains instruction and data arrays for PRU0 I2S firmware
• Provides
pre-compiled firmware binary ready for deployment

+187/-0 
pru_i2s_tdm4_pru1_array.h
PRU1 TDM4 firmware binary array                                                   

source/pru_i2s/firmware/TDM4/pru_i2s_tdm4_pru1_array.h

• Added compiled PRU1 firmware binary array for TDM4 mode
• Contains
instruction array and data array for PRU1 TDM4 firmware
• Provides
pre-compiled firmware for PRU1 in TDM4 configuration

+184/-0 
pru_i2s_pru1_array.h
PRU1 I2S firmware binary array                                                     

source/pru_i2s/firmware/I2S/pru_i2s_pru1_array.h

• Added compiled PRU1 firmware binary array for standard I2S mode

Contains instruction and data arrays for PRU1 I2S firmware
• Provides
pre-compiled firmware binary for PRU1 deployment

+174/-0 
pru_i2s_regs.h
TDM4 PRU register definitions and mappings                             

source/pru_i2s/firmware/TDM4/pru_i2s_regs.h

• Added TDM4-specific register definitions and assignments
• Defines
PRU register mappings for TX/RX operations, counters, and buffers

Includes conditional compilation for different I2S modes (TX/RX)

Contains register assignments for ping-pong buffers and status
tracking

+114/-0 
pru_i2s_regs.h
I2S PRU register definitions and mappings                               

source/pru_i2s/firmware/I2S/pru_i2s_regs.h

• Added I2S-specific register definitions and assignments
• Defines
PRU register mappings similar to TDM4 but for standard I2S
• Includes
register assignments for audio data, buffers, and control
• Contains
conditional compilation for TX/RX modes and profiling

+113/-0 
main.c
AM261X I2S diagnostic main application with FreeRTOS         

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/main.c

• Added main application file for AM261X LaunchPad I2S diagnostic

Implements FreeRTOS-based main function with task creation
• Calls
pru_i2s_diagnostic_main function and handles task management

Includes standard system and board initialization

+84/-0   
fw_regs.asm
I2S firmware register initialization assembly                       

source/pru_i2s/firmware/I2S/fw_regs.asm

• Added firmware register initialization assembly file for I2S

Defines firmware register section with configuration values
• Includes
conditional compilation for different TX configurations
• Sets up pin
numbers, buffer addresses, and system event numbers

+113/-0 
fw_regs.asm
TDM4 firmware register initialization assembly                     

source/pru_i2s/firmware/TDM4/fw_regs.asm

• Added firmware register initialization assembly file for TDM4

Similar structure to I2S version with TDM4-specific configurations

Defines register section with buffer addresses and pin assignments

Includes conditional compilation for different modes and PRU instances

+113/-0 
Configuration changes
8 files
pru_i2s_pruss_intc_mapping.h
PRUSS interrupt controller mapping definitions and macros

source/pru_i2s/include/pru_i2s_pruss_intc_mapping.h

• PRUSS interrupt controller mapping definitions and constants

System event, channel, and host interrupt mapping macros
• INTC
initialization data structure template with proper MISRA C compliance

+200/-0 
syscfg_c.rov.xs
ROV configuration for AM261x FreeRTOS debugging                   

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs

• Runtime Object View (ROV) configuration file for debugging support

FreeRTOS ROV integration for AM261x platform

+8/-0     
product.json
Product Metadata Configuration Update                                       

.metadata/product.json

• Added include path for sysconfig directory
• Added "/open_pru"
component to the components list

+2/-1     
pru_i2s_master_icss.cmd
I2S PRU firmware linker command file                                         

source/pru_i2s/firmware/I2S/pru_i2s_master_icss.cmd

• Added linker command file for I2S PRU firmware
• Defines memory
layout for ICSSG PRU with instruction and data memory sections

Includes peripheral memory mappings and section allocations

Configures firmware registers, output samples, and debug buffer
sections

+88/-0   
pru_i2s_master_icss.cmd
TDM4 PRU firmware linker command file                                       

source/pru_i2s/firmware/TDM4/pru_i2s_master_icss.cmd

• Added linker command file for TDM4 PRU firmware
• Identical
structure to I2S linker file with same memory layout
• Defines ICSSG
memory sections and peripheral mappings
• Configures section
allocations for TDM4 firmware variant

+88/-0   
syscfg_c.rov.xs
ROV configuration for FreeRTOS debugging                                 

examples/pru_i2s_diagnostic/single_channel/am263x-cc/r5fss0-0_freertos/ti-arm-clang/syscfg_c.rov.xs

• Added Runtime Object View (ROV) configuration file
• Defines ROV
files for FreeRTOS debugging support
• Simple configuration file for
debugging tools integration

+8/-0     
makefile_ccs_bootimage_gen
Boot image generation makefile with security features       

examples/pru_i2s_diagnostic/single_channel/am261x-lp/r5fss0-0_freertos/ti-arm-clang/makefile_ccs_bootimage_gen

• Added comprehensive makefile for boot image generation
• Defines
build targets for different image formats (appimage, MCELF, signed)

Includes multi-core image generation and XIP support
• Contains
security features like image signing and encryption

+141/-0 
makefile
Added I2S diagnostic example to build system                         

examples/makefile

• Added pru_i2s_diagnostic to the list of subdirectories to build

Simple one-line addition to include new example in build system

+1/-1     
Additional files
37 files
makefile +106/-0 
readme.md +304/-0 
example.syscfg +333/-0 
example.projectspec +114/-0 
makefile +370/-0 
makefile_projectspec +20/-0   
example.syscfg +313/-0 
example.projectspec +120/-0 
makefile +374/-0 
makefile_ccs_bootimage_gen +141/-0 
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
pru_i2s_main.asm +502/-0 
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +85/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
example.projectspec +84/-0   
makefile +90/-0   
makefile_projectspec +20/-0   
pru_i2s_main.asm +517/-0 

@rajul-bhambay rajul-bhambay changed the title Am263x: PRU-I2S Am263x: PRU-I2S[WIP] Apr 17, 2025
@rajul-bhambay
Copy link
Collaborator Author

rajul-bhambay commented Apr 17, 2025

  • Firmware changes
  • Application changes
  • Restructured driver apis

Fixes: PINDSW-8487

Pending Items:
->Include Standard I2S firmware (currently its TDM4)
-> Testing
_> Documentation of code

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from 96bf0b7 to a27184b Compare April 24, 2025 05:41
@nsaulnier-ti
Copy link
Collaborator

Hey @rajul-bhambay, what is TDM4? I assume something to do with time-domain multiplexing, instead of a typo for TDA4?

@rajul-bhambay
Copy link
Collaborator Author

Hey @rajul-bhambay, what is TDM4? I assume something to do with time-domain multiplexing, instead of a typo for TDA4?

Hey @nsaulnier-ti , TDM4 (time division multiplexing 4 channels) is a mode of communication of audio signals. We have 2 modes, I2S and TDM4/TDM8 which is suppported by the TI's TAS6424Q1 coded (class-D amplifier).

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from 26e87e1 to 29b5691 Compare May 9, 2025 10:55
@rajul-bhambay rajul-bhambay changed the title Am263x: PRU-I2S[WIP] Am263x: PRU-I2S Jun 23, 2025
@@ -0,0 +1,186 @@
%%{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,77 @@
%%{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,52 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this file. Can we remove?

@@ -0,0 +1,280 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright year in all files

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this file to board sub-folder as it is not a core example function

/* Function Definitions */
/* ========================================================================== */

int32_t TCA6416_open(TCA6416_Config *config, const TCA6416_Params *params)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this code now? Is this not supported in MCU+ SDK SysConfig under IOEXP module?

#define TEST_PRUI2S0_IDX ( 0 ) /* Test PRU I2S 0 index */
#define TEST_PRUI2S1_IDX ( 1 ) /* Test PRU I2S 1 index */

#define TDM4 ( 1 ) /* TDM4 mode (change to 0 for I2S)*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we have tested both modes. Can you confirm?

*/


void i2s_i2c_io_expander(void)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's review if this can be removed - by using SysConfig

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you review this?

/* debug, increment ISR count */
gPruI2s1RxIsrCnt++;
/* debug, drive GPIO high */
GPIO_pinWriteHigh(CONFIG_GPIO_DEBUG1_BASE_ADDR, CONFIG_GPIO_DEBUG1_PIN);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this GPIO code under some debug macro? Else it adds unnecessary latency to ISRs

@@ -0,0 +1,200 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to SysConfig?

@dhavaljk
Copy link
Collaborator

Can we merge commit? Don't think we need 4

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 3 times, most recently from cd4d050 to 172a2d0 Compare June 26, 2025 12:02
Copy link
Collaborator

@pratheesh-ti pratheesh-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete the documentation changes to merge

@@ -0,0 +1,2692 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the copyright year


#include <stdint.h>
#include <drivers/hw_include/cslr.h>
#include <drivers\hw_include\am263x\cslr_iomux.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be consistent with use of "/" vs ""

#include <kernel/dpl/SemaphoreP.h>
#include <drivers\hw_include\am263px\cslr_intr_r5fss0_core0.h>
#include <drivers\pinmux\am263x\pinmux.h>
//#include "ti_drivers_config.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if not relevant

#define PRUI2S_PRU_INTC_SYSEVT2_IDX ( 2 ) /* I2S error system event index */

/* Number INTC channels per PRU */
#define PRUI2S_PRUICSS_INTC_NUM_CHANNELS_PER_PRU \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next line is not really warranted here?

pSwipAttrs->rxPin[i].pinNum = temp8b;
}

/* TBD: SoC PAD address lookup */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove if not relevant anymore

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems to redefine a bunch of functions definted in pruicss driver in MCU+ SDK. Is this intentional?

@@ -0,0 +1,200 @@
/*
* Copyright (c) 2021, Texas Instruments Incorporated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the year

@@ -0,0 +1,280 @@
/*
* Copyright (C) 2021 Texas Instruments Incorporated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this file to board sub-folder as it is not a core example function

@@ -0,0 +1,113 @@
;
; Copyright (c) 2021, Texas Instruments Incorporated
; All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add firmware design document in md format here under firmware/I2S/docs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check this comment @rajul-bhambay

* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdio.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Readme.md following other examples in open-pru, explaining the examples and other details

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 034f165 to 52e4c10 Compare July 10, 2025 11:08
pratheesh-ti
pratheesh-ti previously approved these changes Jul 11, 2025
Copy link
Collaborator

@pratheesh-ti pratheesh-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding firmware documentation. Can do dedicated PR for this

@nsaulnier-ti
Copy link
Collaborator

@dhavaljk @manojKoppolu @rajul-bhambay let's discuss the overall structure of this project and the source folder, perhaps on Wednesday's meeting?

I am trying to understand the logic of the overall project structure (e.g., not actually including any PRU code under examples, keeping it all under source), and function of different folders (especially .meta). If we want to keep the proposed structure of "source" [1], we would need to move the files a bit:

source

  • linkers
  • macros
  • defines
  • drivers
    • pru_i2s

[1] https://confluence.itg.ti.com/display/ProcSW/OpenPRU+Repository+Structure+Proposal

Copy link
Collaborator

@nsaulnier-ti nsaulnier-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to understand the logic behind the folder structures before we merge this in. Best to discuss verbally in the team meeting.

@pratheesh-ti
Copy link
Collaborator

/review

PRUI2S_IoBuf rdIoBuf;
PRUI2S_IoBuf wrtIoBuf;
int32_t status = PRUI2S_DRV_SOK;
#ifdef _DBG_PRUI2S_RX_TO_TX_LB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is loopback mode tested and/or documented?

DebugP_log("Build timestamp : %s %s\r\n", __DATE__, __TIME__);

/* Debug, configure GPIO */
#ifdef SOC_AM263X
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tabs for #ifdef and #endif


/* Debug, configure GPIO */
#ifdef SOC_AM263X
GPIO_setDirMode(CONFIG_GPIO_DEBUG0_BASE_ADDR, CONFIG_GPIO_DEBUG0_PIN, CONFIG_GPIO_DEBUG0_DIR);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add comment to describe the use of these GPIOs?

return;
}
/* Check PRU I2S0 instance is Tx only */
DebugP_assert((swipAttrs.numTxI2s > 0) && (swipAttrs.numRxI2s == 0));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we documenting that default mode is TX and this line needs to be updated if any configuration change is done?

/* debug, increment ISR count */
gPruI2s0TxIsrCnt++;
/* debug, drive GPIO high */
#ifdef SOC_AM263X
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should this be specific to AM263x only?

/* Get error status */
PRUI2S_getErrStat(handle, &errStat);

if (errStat & ERROR_BIT_POSITION(I2S_ERR_OVR_BN))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all these error cases tested?

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 0106a2f to c6bc845 Compare October 7, 2025 12:50
@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from 514366f to 2c46065 Compare October 7, 2025 13:09
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed?

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch 2 times, most recently from c8d1d4b to 50bd104 Compare October 8, 2025 05:21
@rajul-bhambay
Copy link
Collaborator Author

Resolved Build issues for R5F and PRU firmware projects

CONTIUNE_INIT:
;Clear registers R0-R29. 4*30=120 bytes
ZERO &r0, 120
LDI32 r30, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zero &r0, 128 shall do and remove both ldi32s?

.endif

LDI32 scratchreg2, I2S_TX_INSTANCE_PING_PONG_STAT_ADD
LDI32 scratchreg0, 0x2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LDI is sufficient

SBBO &scratchreg0, scratchreg2, 0, 1

;I2S_RX_INSTANCE_PING_PONG_STAT_ADD = I2S_TX_INSTANCE_PING_PONG_STAT_ADD+1
LDI32 scratchreg0, 0x1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LDI is sufficient

;If set, this means underflow has happened.
;Below Initializations can be avoided but after power on, registers
;may contain random addresses and may result in accessing illegal addresses.
LDI32 ch0_data_tx, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zero &ch0_data_tx, 4

;Below Initializations can be avoided but after power on, registers
;may contain random addresses and may result in accessing illegal addresses.
LDI32 ch0_data_tx, 0x0
LDI32 scratchreg0, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zero &scratchreg0, 4


; Load pin mask registers
.if $isdefed("I2S_TX")
LDI32 i2s_instance_fs_pin_pos, I2S_INSTANCE_FS_PIN_POS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be LDI, given constant is 16-bit

;If set, this means underflow has happened.
;Below Initializations can be avoided but after power on, registers
;may contain random addresses and may result in accessing illegal addresses.
LDI32 ch0_data_tx, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be LDI, given constant is 16-bit

;Below Initializations can be avoided but after power on, registers
;may contain random addresses and may result in accessing illegal addresses.
LDI32 ch0_data_tx, 0x0
LDI32 scratchreg0, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be LDI, given constant is 16-bit

;may contain random addresses and may result in accessing illegal addresses.
LDI32 ch0_data_tx, 0x0
LDI32 scratchreg0, 0x0
LDI32 tx_buf_size, 0x0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be LDI, given constant is 16-bit. Looks to combine if contiguous

@@ -0,0 +1,113 @@
;
; Copyright (c) 2021, Texas Instruments Incorporated
; All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check this comment @rajul-bhambay

@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 50bd104 to 4a6cef1 Compare October 8, 2025 09:19
@rajul-bhambay
Copy link
Collaborator Author

Need to move firmware design mentioned in example/pru_i2s_diagnostics/readme.md to source/pru_i2s/docs/readme.md

Copy link
Collaborator

@nsaulnier-ti nsaulnier-ti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical changes are readme and project level makefile. Would like a discussion on the other comments.

@@ -0,0 +1,47 @@
include ../../imports.mak
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajul-bhambay please update the project makefile based on the latest empty project example:
https://github.com/TexasInstruments/open-pru/blob/main/examples/empty/makefile

You will update these sections:

  • project information
  • Target definitions

And these sections will be unmodified:

  • Prebuild checks (unless you want to add another dependency other than MCU+ SDK)
  • Make and clean commands

Copy link
Collaborator Author

@rajul-bhambay rajul-bhambay Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting that. Made the changes now

- Code Composer Studio 12.81
- Sysconfig 1.23.1
- mcu_plus_sdk_am263x
- mcu_plus_sdk_am261x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there minimum MCU+ SDK requirements? Or only minimum SysConfig version requirements?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioned now

@@ -0,0 +1,90 @@
################################################################################
# Automatically-generated file. Do not edit!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect that customers will be modifying the I2S firmware? (e.g., customer porting to AM263Px, AM64x R5F, etc).

If yes, my preference would be to align the PRU makefiles with the other PRU makefiles in the open-pru repo:
https://github.com/TexasInstruments/open-pru/blob/main/examples/empty/firmware/am261x-lp/icss_m0_pru0_fw/ti-pru-cgt/makefile

include $(OPEN_PRU_PATH)/imports.mak
SYSCFG_DIR := $(CCS_PROJECT_DEBUG)/syscfg
CG_TOOL_ROOT := $(CGT_TI_PRU_PATH)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is PRU linker.cmd file generated by SysConfig?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, I see that a shared linker.cmd file seems to be used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the linker file. Somehow i missed to remove that after moving memory related things to memory configurator in sysconfig

@@ -0,0 +1,88 @@
/****************************************************************************/
/* ICSSG_PRU.cmd */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help me understand the vision for this linker.cmd file.

  • It used to be PRU_ICSSG, and has been modified for AM26x
  • It CANNOT be used for both PRU_ICSSG and PRU-ICSS in its current state, since AM243x/AM64x only have 12kB IRAM
  • It still lists a bunch of PRU_ICSSG stuff, like a memory allocation for RTU
  • PRU_SHAREDRAM could be a memory conflict if both PRU0 & PRU1 have a dbgBuf region
  • please verify how you want to be using the memory regions (e.g., do PRU0 and PRU1 ever need to be referring to the same memory region? or are they always going to be using separate memory?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting this. Let me change it wrt AM26x.
dbgBuf region is not used by any core (maybe it was added to have a debug region for initial version of firmware for AM243x/64x).

- TDM functionality
- I2S functionality

Fixes: PINDSW-8487,9295

Signed-off-by: Rajul Bhambay <r-bhambay@ti.com>
@rajul-bhambay rajul-bhambay force-pushed the a0497643_PINDSW-8487_PRU_I2S branch from 4a6cef1 to 049eaaf Compare October 9, 2025 07:42
@@ -0,0 +1,88 @@
/****************************************************************************/
/* ICSSG_PRU.cmd */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nsaulnier-ti added a commit that referenced this pull request Oct 9, 2025
Most projects either have functions named pru_io_<function_name>, or have
files that are named <filename>_pru_io. Remove all of these unneeded pru_io
references.

Paths to the MCU+ SDK with /pru_io/ in the path are preserved.

TODO: Re-run these commands after these PRs are merged:
* #8
* #81

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
nsaulnier-ti added a commit that referenced this pull request Oct 9, 2025
Most projects either have functions named pru_io_<function_name>, or have
files that are named <filename>_pru_io. Remove all of these unneeded pru_io
references.

Paths to the MCU+ SDK with /pru_io/ in the path are preserved.

TODO: Re-run these commands after these PRs are merged:
* #8
* #81

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
nsaulnier-ti added a commit that referenced this pull request Oct 9, 2025
Most projects either have functions named pru_io_<function_name>, or have
files that are named <filename>_pru_io. Remove all of these unneeded pru_io
references.

Paths to the MCU+ SDK with /pru_io/ in the path are preserved.

TODO: Re-run these commands after these PRs are merged:
* #8
* #81
* #87

grep -rli '_pru_io' | xargs -i@ sed -i 's/_pru_io//g' @
grep -rli 'pru_io_' | xargs -i@ sed -i 's/pru_io_//g' @

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
@pratheesh-ti
Copy link
Collaborator

@rajul-bhambay Please move the firmware sources to example folder from firmware to align with rest of the examples as discussed. We can merge post that

nsaulnier-ti added a commit that referenced this pull request Oct 26, 2025
Most projects either have functions named pru_io_<function_name>, or have
files that are named <filename>_pru_io. Remove all of these unneeded pru_io
references.

Paths to the MCU+ SDK with /pru_io/ in the path are preserved.

TODO: Re-run these commands after these PRs are merged:
* #8

grep -rli '_pru_io' | xargs -i@ sed -i 's/_pru_io//g' @
grep -rli 'pru_io_' | xargs -i@ sed -i 's/pru_io_//g' @

Signed-off-by: Nick Saulnier <nsaulnier@ti.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants