Question about how to write code for s32k314.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Question about how to write code for s32k314.

480件の閲覧回数
Oido
Contributor I

Hello. I am going to work with s32k314 this time. Previously, I worked with s32k144.

But I'm not solving the problem. I'm trying to set up a development environment, but if I create an example of s32k344 in the s32ds 3.4 version, only the main statement is created, and none of the related header files are generated.

Also, I would like to write the code in the way I used in the S32K144 instead of the DioConf_DioChannel_Digital_Output_LED_Q172, STD_HIGH).

For example, when I was S32K144,
PCC->PCCn [PCC_PORTA_INDEX] = PCC_PCCn_CGC_MASK; 
PCC->PCCn[PCC_PORTB_INDEX] = PCC_PCCn_CGC_MASK; 
 
PTA->PDDR = (0<<0)|(0<<1)|(1<<10)|(1<<11)|(0<<13); 
PTB->PDDR = (1<<2)|(1<<5)|(0<<6)|(1<<7); 
 
PTA->PSOR = (1<<10)|(1<<11); 
 
PORTA->PCR[0] = PORT_PCR_MUX(1); 
PORTA->PCR[1] = PORT_PCR_MUX(1); 
PORTA->PCR[13] = PORT_PCR_MUX(1); 
PORTB->PCR[2] = PORT_PCR_MUX(1);
I wrote the code this way.
But S32K3XX doesn't even exist in Cookbook, so it's not building the foundation for how to write that code.
I would like to write a code for S32K3XX in the way I used to do. Is there any material I can find? If not, if you tell me the code that declares the input and output of the GPIO, which is a low-level example I just wrote, I will use it as a base.
S32DS 3.5 can't be used in my computer environment after a while to install it, maybe it recognizes it as a virus or the executable file disappeared. I'm currently using S32DS 3.4.
0 件の賞賛
返信
12 返答(返信)

447件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

Development for applications in newer packages has been migrated from registers (as the S32K1xx's Cookbook) to application layer as LLD or MCAL. You can still implement projects the way you have been doing in S32K144, but there is no documentation for the S32K3xx's family.

Using S32DS3.4, you can refer to the RTD packages version 2.0.0 for S32K3xx, which include the libraries for all of the modules. You can import the Siul2_Dio_Ip_Example_S32K344 (there is no specific example for the S32K314 derivative):

Julin_AragnM_0-1719271218683.png

This example toggles red LED from the S32K344 EVB, but you can reconfigure the output pin inside the "Pins" and "Peripherals" views. You can go over the HOWTO: Create a Blinking LED example project using S32K1xx RTD without AUTOSAR guide for some context in how to create a project with RTD. It showcases S32K1xx packages, but it is the same principle for the S32K3xx family. There is also the Pins and Clocks training with RTD.

You can download the RTD's from this page: Real-Time Drivers (RTD) | NXP Semiconductors

Best regards,
Julián

0 件の賞賛
返信

430件の閲覧回数
Oido
Contributor I

Thank you for your answer.
But I get an error when I use an example because the files don't exist. Is there a workaround?

Also, I want to use the register directly rather than using the SDK function. Is there even one exemplified code?

I found a code that I can use by myself and wrote it, but I don't have a working PCB yet, so I don't know if this is a working code yet, but can you check if this is the code that interrupts pin 31 with FALLING EDGE and uses pin 18 as an output?

I post a picture of my problems when using codes and examples that I don't know if they work in the existing 144 method.

문제.jpgCODE.jpg

Also, if the file you provided is built unmodified, there will be an error. Is this a file that I need to fix?

ERROR.jpg

0 件の賞賛
返信

412件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

Please go over the "description.txt" or "ReadMe.txt" file before building the application:

Julin_AragnM_0-1719513954930.png

You need to firstly select the project, and then click on either Pins, Clocks or Peripherals view. This will generate the configuration:

Julin_AragnM_1-1719514082521.png

After opening the S32 Config Tools perspective, you can click "Update Code" which will generate the files on the project:

Julin_AragnM_2-1719514109366.png

Best regards,
Julián

0 件の賞賛
返信

332件の閲覧回数
Oido
Contributor I

sdk.jpg

Thank you for your answer, and thanks to you, I managed to operate the code related to the example on the s32k344 EVB Q172 board with PORT and PIT examples.
When I pressed SW5 switch using a combination of examples, I succeeded in turning on the GREEN LED and turning off the GREEN LED and turning on the RED LED after 2 seconds with the PIT.

But I don't like it this way: for example, Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0,g_pin_mux_InitConfigArr0);

when I saw this phrase, I would never know in my life that

Siul2_Port_Ip_Init(uint32 pinCount, const Siul2_Port_Ip_PinSettingsConfig[]) //

PinCount and config[] should have NUM_OF_CONFIGURED_PINS0 and g_pin_mux_InitConfigArr0 variables in their place.

That's why I asked you how you can declare the register yourself.

reg.jpg

I declared the register myself, setting the PTA 18 and PTA 29 pins as output and making the 5V output go out.
Although PIT failed because it failed to find the format of several registers such as LDVAL, I'm sure I'll be able to find a way with help here.
S32K144 has various codes to declare registers in the cookbook, so other commands were guessed and written, but the S32K3XX series does not have a cookbook, so only hard-to-recognize example codes consisting of SDKs exist.

If I use a combination of example sentences, I'm sure I can make it work right away, but I don't think it's going to help me develop my abilities.

Look at the example. Can't you do anything for me other than that?

I beg you.

0 件の賞賛
返信

319件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

Unfortunately, there are no bare-metal examples for S32K3. Just those that use High Level Driver (HLD) or Low-Level Driver (IP) which you can find in its respective RTD for S32K3xx devices.

You can refer to the examples in the RTD package or the ones in community (such as Example S32K312 PIT timer Toggle LED DS3.5 RTD300 - NXP Community) for guidance.

There is a list of HOWTOs (S32DS - list of HOWTOs - NXP Community) with some guides for creating applications, as well as an application note for migration (AN13414: S32K1 to S32K3 Migration Guidelines).

Best regards,
Julián

0 件の賞賛
返信

285件の閲覧回数
Oido
Contributor I

All right, I don't like the method, but I can combine the example codes to operate the interrupt of CAN, PIT, and GPIO.

Now I want to play ADC and STANDBY mode, but I don't know these even if I look at the examples.
If I want to go back and forth between Standby mode and normal mode, do I make it using POWER and WKUP together?
And ADC is a bit different from the S32K144 I was using.
Not just using ADC, but other bctu-like functions.

I make a new one in modsettingconf in the power function and change the operating mode to standby to enter standby mode
I ordered it set right away, and it turned off with a startup error as soon as I started debugging.

Also, I don't know what btcu is and when I just tried working on the example, it's fixed to the value first called by adc and doesn't move in real time, unlike in 144.
I turned the variable resistance of the evb q172 board to change the value of the voltage entering the adc, but I confirmed that the value does not change in the realtime expression.
Can you give me a guideline for adc and standby mode?

0 件の賞賛
返信

274件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

I would recommend firstly going over the reference manual and the various posts from the community, as there are many threads with similar issues. 

The BCTU (Body Cross-triggering Unit) accepts ADC conversion-request trigger inputs and routes those requests to one or more ADCs. It also stores each ADC conversion result for CPU access or routing to memory through DMA. Please refer to Chapter 64 from the reference manual.

You can also start with the Adc Sar Bctu example, the "description.txt" file explains the application:

- Part 1: The sequences of conversions are triggered using SW triggering from ADC with 2 modes: normal and injected modes
- Part 2: The sequence of conversion is triggered using SW triggering from BCTU, the ADC results are stored in FIFO index 1

If you want to go between standby and normal mode, you need a wake-up source. Please refer to the S32K3 Low Power Management AN and demos. These examples (even if on an older version of the RTD) showcase various situations for low power and wakeup (gpios, FlexCAN, lpcmp, rti, etc.)

Best regards,
Julián

0 件の賞賛
返信

268件の閲覧回数
Oido
Contributor I

Thank you for your answer.
I'm already S32K344_GPIO_Wkup_S32DS_3_4_RTD_LLD_2_0
I referred to the example. When I activated the Q172 board without any modifications, the BLUE LED is activated and as soon as I press the SW5 switch, it disconnects from the debug and turns off the BLUE LED. Is this the right thing to do?
When it was S32K144, the debug was never disconnected when I went from normal RUN mode to VLPS mode. Is it impossible to connect with debug in S32K344?? And is there a way to check that I went into STANDBY mode?

For example, measuring the current through a tester.

Also, I am not sure what you mean by the information about ADC.
I've already tried the ADC_BCTU example and checked the data variable with real time expressions. However, I only read it once when I first started debugging and saw that the value was fixed and remained unchanged after that, so I couldn't find which part to modify to keep updating the value in real time. Of course, I've also read description.txt.

I appreciate your response.

Additional problems occur and add content.
I added wkpu and power to follow the standby example.
However, nothing is recorded in the c file related to wkpu.
Even if you click the update code button.

err.jpg

0 件の賞賛
返信

215件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

Yes, it is expected behavior since the debug interface also goes to low power. 

If you want to know if MCU is in low power, I suggest measuring current. As current consumption depends on various factors such as which modules are enabled, what frequency is feeding Core and other peripherals, temperature conditions, and so on, the datasheet lists the test cases for various power modes.

Please refer to the “Table 15 STANDBY mode supply currents”.

As for the added module, when generating the code (with "Update Code" button), are the files generated into the project explorer view? ("generate" folder). This may be just a code preview issue.

Best regards,
Julián

0 件の賞賛
返信

161件の閲覧回数
Oido
Contributor I

Hello, I operated ADC only as an ADC function without BCUT. I don't know if it's okay to use it like this, but when I turned on the variable resistor, the value input to the ADC port changed in real time.

What are some ways to measure the current in real time? I know the method of measuring the current with a digital multimeter because the + and - lines come out, but the EVB board does not have a separate wire for measuring the current.

0 件の賞賛
返信

136件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Oido,

It is fine the way you implemented it. The example only includes BCTU to showcase how to use the triggers for conversion.

For current measurement, you may need to remove R303 and R349 and measure at J10, J15.

Julin_AragnM_1-1721068858924.png

Best regards,
Julián

 

0 件の賞賛
返信

106件の閲覧回数
Oido
Contributor I

I didn't solve the problem, but thank you for your answer.
A PCB using S32K314 came, but I wrote a new article because it seems that the MCU is not powered on.
I'm sorry, but could you help me one more time?

0 件の賞賛
返信