ConfigTools problem with I2S

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ConfigTools problem with I2S

2,391 Views
gh78731
Contributor III

I am having trouble setting up an I2S peripheral in ConfigTools/Peripherals for iMX RT1020.

The ADC is I2S format, ADC is the source for all I2S clocks, L and R channel, 24 bits packed in 32 bit word, sample rate is 200 kHz.

Under SAI1/GeneralConfiguration/Record/Rx configuration/Bit clock (BCLK) configuration...

I have set Mode=Slave and it asks for a Slave input frequency, which should be 12.800 MHz, or 0xC35000

It will not accept any value I provide and shows error. My value is within the valid range in the error message.

I am blocked and can not proceed.

I note that:

1.) If I hover over the input box, it says type is string, while all other frequency boxes say type is integer or enum. Do I care?

2.) At the bottom of SAI1/GeneralConfiguration/Record/Data Configuration, I see that it says Calculated bit clock frequency is 6.4 MHz. I calculate that 2 words * 32 bits * 200000 is 12.8 MHz This seems broken.

I am using RT1020 EVK, and hardware hacking in a different ADC in place of CODEC. Is there something in the EVK board definition files somewhere that I need to over-ride? 

Labels (1)
Tags (2)
13 Replies

2,051 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Graham, 

You are in the correct place to report this. 

To paste code snippets you need to select the Syntax Highlighter. 

pastedImage_1.png

A new window will pop-up. Under language select C and then copy your code on the window. Finally, click OK. 

Regarding the problems that you are facing, could you please tell me which version of MCUXpresso IDE are you using? Also, could you please clarify if you are using the standalone version of MCUXpresso Config tools or the version that is integrated with MCUXpresso IDE? 

Regards, 

Victor 

0 Kudos

2,051 Views
gh78731
Contributor III

Regarding your question about version of MCUExpresso and ConfigTools:

I am using

MCUXpresso IDE v11.1.1  Build 3241

New download and install from about two weeks ago.

The ConfigTools are built into the MCUExpresso IDE.

Thanks,

--- Graham

==

0 Kudos

2,051 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Graham, 

Thanks for sharing the additional information. Could you please share a detail step-by-step guide on how I can reproduce the behavior you mentioned on my side? 

Regards, 

Victor 

0 Kudos

2,051 Views
gh78731
Contributor III

Context:
I am trying to build a proof-of-concept of a 
DMA based I2S import of real time DC samples on an iMX_RT1020EVK. I used your 
evkmimxrt1020_
sai_interrupt_record_playback 
demo as the closest demo application, and started modifying it for my 
ADC.

The 
ADC is a Cirrus CS5340, running at 200 kspsMCLK=12.8 MHz, configured as a 
clock master, so the 
RT-1020 I2S peripheral must be a ‘clock slave’. Transfer 
format is I2S, 24 bit Left and Right channels, each packed in a 32 bit word. 
So, bit clock will be 200 
ksps x 64 bits = 12.8 Mbps.

I have assigned:
SAI1_RX_
BCLK  to pin 84, GPIO_AD_B1_06
SAI1_RX_DATA0 to pin 87, 
GPIO_AD_B1_05
SAI1_RX_SYNC  to pin 88, 
GPIO_AD_B1_04
SAI1_
MCLK     to pin 92, GPIO_AD_B1_00
[Yes, I will need to cut track and jumper on the 
EVK.]

Peripheral Configuration tool:
Mode= 
eDMA, Peripheral = SAI1
Peripheral Usage = Record
RX Configuration 
     Mode = Slave
     Slave Input Frequency = 12.8 MHz      [Would not accept 12800000 or 0xC35000]
Frame sync
     Mode = Slave

Sample rate = 200000
Data Channel = 0

Data configuration:
     Word Width = 32 bits
     Data Order = 
MSB first
     First bit shifted = 33       [What should this be ?, 32 or 33 ?]
Number of words in frame = 2

Calculated bit clock frequency = 3.2 MHz  [This is wrong by factor of x4]

PROBLEMS:
1.) Slave input frequency would not accept raw integer value.
2.) Generated code in peripheral.c is missing variable assignment for .
bclkSource so will not compile.
3.) Tool displays calculated bit clock incorrectly.

If I manually override the read-only protection on peripherals.c, and edit
.
bclkSource = kSAI_BclkSourceMclkDiv
then the code will compile, although I have not tested it yet.


// Clips from peripherals.c as generated

/* 
```
- whole:
      - rx_group:
        - sai_transceiver:
          - bitClock:
            - modeM: 'slave'
            - slaveBitClockFrequency: '12.8 MHz'
            - bitClockSource: 'kSAI_BclkSourceMclkDiv'
            - bitClockSourceFreq: 'BOARD_BootClockRUN'
            - bclkPolarityM: 'kSAI_PolarityActiveLow'
            - bclkInputDelayM: 'false'
``` */

// ... 

/* SAI1 Rx configuration */
sai_transceiver_t SAI1_Rx_config = {
  .masterSlave = kSAI_Slave,
  .bitClock = {
    .bclkSrcSwap = false,
    .bclkSource = ,   // <---  Missing variable /  litteral
    .bclkPolarity = kSAI_PolarityActiveLow,
    .bclkInputDelay = false
  },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos

2,051 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Graham, 

Thanks for providing a more detailed explanation! Regarding the problems that you are facing please see my comments below. 

1.) Slave input frequency would not accept raw integer value.

The format that you use to put the frequency is correct (12.8 MHz). However, I understand your confusion. I will give the feedback to the developers to see if they can add a note about the format that you should use. 
2.) Generated code in peripheral.c is missing variable assignment for .bclkSource so will not compile.

When you configured the SAI module with MCUXpresso Config Tools, at section Signals configuration (specifies synchronization mode and bticlock swap) what did you select as BCLK source? 

3.) Tool displays calculated bit clock incorrectly.

You are right on this, I'm currently checking this with the developers. 

Regards, 

Victor 

0 Kudos

2,051 Views
bowerymarc
Contributor V

I noticed that if you set the mode to master first, then select a clock source, then select slave and continue with your setup, when you generate code, the source you selected is put in the code, so it then compiles.  Much easier than re-editing the file every time.  Still, it's a bug.

2,051 Views
gh78731
Contributor III

Victor:

In general, I want the SAI1 I2S peripheral to be a receive-only "clock slave" and accept all clock/sync signals from an external source.

In Signals Configuration, I have specified

     BCLK source for "TX part (playback)" to "N/A"

     BCLK source for "RX part (record)" to "Own BCLK generator or pin"

     SYNC source for "TX part (playback)" to "N/A"

      SYNC source for "RX part (record)" to "Own SYNC generator or pin"

I want the RX BCLK input to be pin 84, GPIO_AD_B1_06

I want the RX SYNC input to be pin 88, GPIO_AD_B1_04

 

I also note that, as an additional (minor) issue, that the tool is throwing Warnings (in the "Problems" window) warning that

"SAI1, TX_BCLK pin needs to be routed. Problem must be solved in another tool."  and

"SAI1, TX_SYNC pin needs to be routed. Problem must be solved in another tool."

But, I am not using the TX side of the peripheral.

I am using the peripheral as a receive only device, and have configured it as such.

Why is it complaining?

I assume that I can ignore the warning, but it should not be complaining.

Thanks,

--- Graham

0 Kudos

2,051 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Graham, 

Thanks for sharing more information. I'm currently checking with the developers of the tool if not assigning nothing to bclkSource is expected behavior or not. I will give you an update as soon as possible regarding this. 

Regarding the warnings that you mentioned, the peripherals tool expects that you configure all the pins of the module. But if you don't need the transmitting pins you can ignore these warnings. 

Regards, 

Victor 

0 Kudos

2,051 Views
gh78731
Contributor III

Victor:

Sure. It will likely be tomorrow before I can write it up for you

--- Graham

On Thu, Mar 26, 2020 at 4:44 PM victorjimenez <admin@community.nxp.com>

0 Kudos

2,051 Views
gh78731
Contributor III

@Victor Jimenez 

Thanks for your comment. I have a discussion going over on iMX RT1020 about not being able to access the syntax highlighter from Google Chrome.  If I switch to Microsoft Edge, I can see the 'three dots' and access the Syntax Highlighter.

But, if I use Google Chrome, what I get for the toolbar is

ToolBar Snip.JPG

No three dots, no access to Syntax Highlighter.

I can switch to MicroSoft Edge for reporting problems involving code snippets, but I prefer not to have to do that.

--- Graham

0 Kudos

2,051 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Graham, 

When replying from Google Chrome, don't reply directly from the notification. Go inside the case and then click either on reply on the comment or reply to original question at the bottom of the case. Here you will be able to see the three dots. I'm using google chrome right now. 

pastedImage_1.png

Best Regards, 

Victor 

0 Kudos

2,051 Views
gh78731
Contributor III

I made some progress.

Although the Slave Input Frequency window would not accept 12800000 or 0xC35000, or 12.8,  it turns out that it does accept "12.8 MHz" which is counter intuitive, but I am now past this configuration problem.

Now, I still note that at the bottom of SAI1/GeneralConfiguration/Record/Data Configuration, I see that it now says Calculated bit clock frequency is 3.2 MHz. I calculate that 2 words * 32 bits * 200000 Hz is 12.8 MHz. This seems broken.

Do I care?

0 Kudos

2,051 Views
gh78731
Contributor III

I am having additional problems with the ConfigTools.

The tool generates "peripherals.c" which the user is not supposed to edit.

In my case, the bit clock source is missing, and the file will not compile, and project build is blocked.

(formatting removed by 'Jive' forum tool)

/* SAI1 Rx configuration */
sai_transceiver_t SAI1_Rx_config = {
    masterSlave = kSAI_Slave,
    bitClock = {
    bclkSrcSwap = false,
    bclkSource = ,                         // <-------- missing variable or literal
    bclkPolarity = kSAI_PolarityActiveLow,
.bclkInputDelay = false
},

Up in the comments section, the comments say:

- whole:
- rx_group:
- sai_transceiver:
- bitClock:
- modeM: 'slave'
- slaveBitClockFrequency: '12.8 MHz'
- bitClockSource: 'kSAI_BclkSourceMclkDiv'
- bitClockSourceFreq: 'BOARD_BootClockRUN'
- bclkPolarityM: 'kSAI_PolarityActiveLow'
- bclkInputDelayM: 'false'

If I over-ride the "Read Only" protection on 'peripherals.c", and change the line involving .bitclkSource to read

    .bclkSource = kSAI_BclkSourceMclkDiv,

then the project does compile, although I have not tested operation, yet.

Is this the correct place to report tool bugs?

Will problems reported here be picked up by the tool development teams, or is there another place to report tool problems?

How do I paste in software snippets and preserve the formatting?

--- Graham

0 Kudos