S32K Knowledge Base

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

S32K Knowledge Base

Labels

Discussions

Sort by:
******************************************************************************** * Detailed Description: * The purpose of this example is show how to keep data in SRAM memory over SW * reset. SW reset is triggered by pressing the SW3 button on the S32K118EVB. * Reset is delayed for 514 LPO cycles. In the RCM interrupt, SRAMU_RETEN is * cleared allowing to retain SRAM data during the reset. After SW reset, * SRAMU_RETEN is set to allow accesses to SRAM. * File startup_S32K116.S in modified to skip ECC RAM initialization for SW reset * source. To check whether stored data stayed unmodified in the SRAM, specified * address is read and the LED lights up. * ------------------------------------------------------------------------------ * Test HW: S32K118EVB-Q064 * MCU: S32K118 LAMLH 0N97V QTZE1802B * Fsys: fsys = 48MHz * Debugger: Lauterbach Trace32 * Target: Debug * Terminal: 19200-8-no parity-1 stop bit-no flow control * EVB connection: default ******************************************************************************** Revision History: Ver Date Author Description of Changes 0.0 May-17-2023 David Tosenovjan Initial version *******************************************************************************/
View full article
What is “Flash Driver” (The following content is taken from Klaus Emmert->“FLASH Bootloader User Manual Version 2.7”) “The Flash Driver(actual flash algorithm) is the hardware dependent code for performing the flash functions.In most cases, programming flash memory from flash is not possible.Therefore the Flash Driver is downloaded and executed into RAM to allow programming of the application.The advantage of downloading the flash algorithm into RAM is that updates to the flash algorithms are possible without the need to reprogram the primary bootloader. The algorithm is cleared from RAM upon completion of the download to avoid accidental calls to the flash functions while in application. In special cases the flash algorithms are kept in flash memory and copied to RAM when needed. Of course the possibility of changing the flash algorithms is no longer available when this configuration is used. Moreover, there is a risk that the flash memory will be unintentionally erased from an accidental call to these functions. A remedy to correct this would be to encrypt the corresponding program code, such as e.g an XOR or the like.”   Regarding the demos -The software is using “S32 Design Studio for S32 Platform V3.4” and the SDK is “RTM 4.0.3” - Hardware based on S32K142-EVB -two demo provided, one for making “flash driver”, another is for testing the flash driver image     ·“Flash_Driver_Source_Project”  this routine used for making flash driver image.     ·“Flash_Driver_Source_Project_Test” this routine used for testing flash driver image.   ·Flash driver image making process 1.Create a new project and add the flash component       Refer to the demo provided and modified main.c file. Note 1 define function index table in main.c 2.Modify the link file Note 2 modified S32K142_32_flash.ld file   Note 3 modified S32K142_32_flash.ld file 3.Add “attribute” commands for the functions necessary to operate flash   Note 4 add "attribute" to function,like this         If another function is referenced in a function, then we also need to add “attribute” to the referenced function. 4.Compile the project and check the xx.map file to confirm whether the allocated address space is correct.   Note 5 check Flash_Driver_Source_Project.map 5.Make flash driver   Note 6 create flash image   Note 7 choose image format   Note 8 make flash driver image       New a “xx.s19” file and then copy the data which range of 0x1fffe000~0x1ffffffff into this file   Note 9 change link order if necessary       If some functions are distributed in different files, the function address allocated can be changed by changing the link order.   The process of testing the flash driver image 1.Create a new project without adding flash component.       You still need to create a new project, but you don’t need to add the Flash component to it. 2.Modify the link file as before. 3.Refer to the provided demo and modify main.c file. 4.Compile the project, check the .map file, and confirm whether the address space of the allocated array location is correct   Note 10 make sure Function_TABLE already put on the right place 5.Enter debug section, import the prepared flash driver image.   Note 12 import flash driver image before operate flash module 6.Test whether the flash driver can work normally.   Note 13 check the test result So far, we know how to make a flash driver image and how to test the flash driver image. This method is not limited to making functions related to flash operations, and other functions can also be used in this way, but there are few applications with such application scenarios.
View full article
******************************************************************************** * Detailed Description: * Example is based on Siul2_Port_Ip_Example_S32K344 and its purpose it to show * how to integrate ITCM and DTCM memories to the project. * * Modification has been done in following files: * - main.c * - startup_cm7.s * - linker_flash_s32k344.ld * * In the main function, function is placed to ITCM memory and executed. Also * data field in placed to DCTM and accessed. * ******************************************************************************** * Test HW: S32K3X4EVB-Q172 * MCU: S32K344 * Compiler: S32DS3.4 * SDK release: PlatformSDK_S32K3_3_0_0 * Debugger: Lauterbach Trace32 ******************************************************************************** Revision History: Ver Date Author Description of Changes 0.1 Apr-04-2019 David Tosenovjan Initial version *******************************************************************************/
View full article
/******************************************************************************** Detailed Description: Example shows possible implementation of multiple ADC conversions using SDK. Here 7 channels are sampled periodically. 2 ADC modules and 2 PDBs are used. ADC0 is configured to sample 3 channels, ADC1 4 channels. PDBs are set to back-to-back mode to perform chain conversion as shown in RM's Figure 46-3. PDB back-to-back chain forming PDB0-PDB1 ring. Within ADC component you need to select ADC input to be measured for each item in configuration list. For ADC0 ch5 External input channel 28 is selected, as it is connected to potentiometer on the EVB. PDB0 is triggered by LPIT ch0 at 500ms rate. Two DMA channels are configured to read result registers from both ADCs. * ------------------------------------------------------------------------------ * Test HW: S32K148EVB-Q144 * MCU: FS32K144UAVLQ 0N20V * Target: Debug_FLASH * EVB connection: UART terminal 115200, 8N1 * Compiler: S32DS.ARM.3.4 * SDK release: S32SDK_S32K1XX_RTM_4.0.3 * Debugger: S32DS ******************************************************************************** Revision History: Ver Date Author Description of Changes 1.0 Feb-21-2023 Petr Stancik Initial version, based on adc_hwtrigger_s32k148 *******************************************************************************/
View full article
/******************************************************************************** Detailed Description: Example shows possible implementation of multiple ADC conversions using SDK. Here 7 channels are sampled periodically. 2 ADC modules and 2 PDBs are used. ADC0 is configured to sample 3 channels, ADC1 4 channels. PDBs are set to back-to-back mode to perform chain conversion as shown in RM's Figure 46-3. PDB back-to-back chain forming PDB0-PDB1 ring. Within ADC component you need to select ADC input to be measured for each item in configuration list. For ADC0 ch5 External input channel 28 is selected, as it is connected to potentiometer on the EVB. PDB0 is triggered by LPIT ch0 at 500ms rate. * ------------------------------------------------------------------------------ * Test HW: S32K148EVB-Q144 * MCU: FS32K144UAVLQ 0N20V * Target: Debug_FLASH * EVB connection: UART terminal 115200, 8N1 * Compiler: S32DS.ARM.3.4 * SDK release: S32SDK_S32K1XX_RTM_4.0.3 * Debugger: S32DS ******************************************************************************** Revision History: Ver Date Author Description of Changes 1.0 Jan-26-2023 Petr Stancik Initial version, based on adc_hwtrigger_s32k148 *******************************************************************************/
View full article
************************************************************************************************ * Detailed Description: * The example shows how to skip an instruction * that causes uncorrectable ECC fault exception during C40_Ip_Read(). * ----------------------------------------------------------------------------------------------- * Test HW: S32312EVB-Q172 * MCU: S32K312 * Debugger: S32DS 3.4, PEMicro Multilink * Target: internal_FLASH *************************************************************************************************
View full article
Attachment is the UDS bootloader solution of S12Z, S32K1xx and S32K3xx. The package include projects and user guide. All projects are verified over ECU BUS(0.2.22). Unified bootloader V2.1 Vs V2 1. Integrated S32K312, S32K314, S32K324, S32K344 PC tool(https://github.com/frankie-zeng/ECUBus😞 1. ECU BUS 2. Add CAN FD support 3. Easy of use 4. The tool only support PEAK Disclaimer: 1. All projects/source code are demo code          
View full article
******************************************************************************* * * The purpose of this demo application is to present a usage of the ADC_SAR and * BCTU IP Driver for the S32K3xx MCU. * * The example uses the PIT0 trigger to trigger BCTU conversion list. Five standard * ADC channels are selected to be converted. * Converted result from BCTU data register are moved by DMA into result array. * This result array should be placed into no cacheable area if data cache is enabled. * * ADC channel S10 is connected to board's potentiometer, and converted value is * used to dim board's LED. * * * ------------------------------------------------------------------------------ * Test HW: S32K3X4EVB-Q172 * MCU: S32K344 * Compiler: S32DS3.4 * SDK release: RTD 1.0.0 * Debugger: Lauterbach * Target: internal_FLASH ********************************************************************************
View full article
******************************************************************************** The purpose of this demo application is to show you the usage of the FlexCAN module configured to use CAN FD and Enhance RXFIFO using the S32 RTD API. - This demo application requires two boards, or single board connected with CAN tool. - CAN FD is enabled with bitrate 500/2000 kbps - MB0 is configured to transmit either std. or ext ID - MB1 is configured to receive ext ID 0xFACE and MB2 to receive std ID 0x1 - Enhanced RXFIFO is enabled and 3 enhanced RXFIFO filter elements (filter + mask scheme) are defined ext ID 0xABCD with mask 0x1FFFFFFF std ID 0x123 with mask 0x7FF std ID 0x456 with mask 0x7FF - Callback function is used as well to handle TX and RX process in MBs and Enhanced RXFIFO - setupCanXCVR function can be called if TJA1153 is used on the board. It expects transceiver in Vanilla state and set TPL to pass all std and ext ID and do not block any message comming from bus. Finally leaving configuration mode without writing to non-volatile memory nor locking the transceiver. * * ------------------------------------------------------------------------------ * Test HW: S32K3444EVB-Q172 * MCU: PS32K344EHVPBS 1P55A * Compiler: S32DS.ARM.3.4 * SDK release: SW32K3_RTD_4_4_2_0_0_D2203 * Debugger: Lauterbach * Target: internal_FLASH * ********************************************************************************
View full article
       This routine implements all four different mask setting methods.Users can refer to these routines to implement some application scenarios.Please note that this routine is for reference only.When posting this routine, I only did some limited tests, and I don't make sure that there are no problems. If you find it, please leave a message and I will revise it in time.       When the program was flashed into the S32K142EVB, the Blue Led will toggles every 500ms, this Led shows that the program is running on well condictions. If a message was received by S32K142EVB from external CAN bus, the Green Led will toggle,at the same time, the S32K142EVB will sent a message to CAN Bus which have the same data with the message received,and the ID is 0x02.At the last,the Red Led will toggle when a CAN error is occurd.   1.FlexCAN Mask Setting Overview          S32K1XX FlexCAN support  Frame mask function ,as you can see the FlexCAN mask can be set to Global Mask or Individual Mask,and user can choose to use FIFO or MB to receive message,but only MB can be used for sending messages.and one more thing you should be care is that the FIFO can not be used for CAN FD,this is because the FIFO data filed only support 8 bit datafiled.           If you use MB14 or MB15, have to set the mask of these tow MBs separately,and you can take a look at the two functions in the below. ->FLEXCAN_DRV_SetRxMb14Mask();  ->FLEXCAN_DRV_SetRxMb15Mask();   2.Hardware Needs. 1.S32k142EVB,(or own made board which can support CAN communications.) 2.CAN TOOL's which used for send or receive messages from CAN Bus on your computer.   If you don't have such tools ,you can use another board which can replace the CAN tools to send or receive CAN messages. 3.S32K142EVB should be powered by external 12V DC, and don't forget to connect the J107 to 1-2.   3.Software Needs. 1.This demo build on S32 Design Studio for ARM V2.2  2.The SDK version is SDK_S32K1XX_15   4.FlexCAN_RX_MB_Mask_Setting 4.1.Set the Mask Type to Global Mask Type.      In this case, we can only receive the messages which ID from 0x300~0x37F and 0x400~0x47F.      If you try to sent the messages with other ID's, the S32K142EVB will not have any reponse!  4.2.Set the Mask Type to Individual Mask Type.      In this routine,we can only receive frames with IDs in the range of 0x400~0x47F. 5.FlexCAN_RX_FIFO_Mask_Setting 5.1.Set the Mask Type to Global Mask Type.      In this routine,we can only receive frames with IDs in the range of 0x10~0x17, 0x20~0x27,0x30~0x37,0x40~0x47, 0x50~0x57,0x60~0x67,0x70~0x77,0x80~0x87. 5.2.Set the Mask Type to Individual Mask Type.      In this routine, we can only receive frames with IDs in the range of 0x10~0x17,0x20~0x27,0x30~0x37,0x40~0x47, 0x50~0x57,0x60~0x67,0x70~0x77,0x80~0x87.   End       If you need to use CAN FD, please note that FIFO cannot be used. Regarding FIFO, it has three filtering formats, you can refer to the following chapters in the data sheet for details. S32K-RM Rev 13. Chapter:55.4.2.15 Rx FIFO Global Mask register (RXFGMASK) Chapter:55.4.6 Rx FIFO structure          
View full article
           The hardware of this routine is based on S32K142EVB, the IDE is S32_Design_Studio for ARM 2018.R1, SDK version is S32K1xx_RTM_3.0.0, PTB12 is used to simulate Hall pulse output,PTC12 and PTC13 are buttons to change the flip frequency of PTB12 port, and PTB13 is used as the input capture port. When using the demo program in this article, you need to connect PTB12 and PTB13 ports.   Here we assume that we are using a brushed DC motor!   1.The Hall sensor       The Hall sensor is a magnetic induction sensor. The magnetic ring and the Hall element form an induction combination. The magnetic ring rotates with the rotor. The Hall induction magnetic ring rotates with the rotor. , 3-pole pairs, 4-pole pairs, etc., each pair of poles is divided into two levels of N.S. A pair of magnetic poles outputs one pulse signal, and multiple magnetic poles output multiple pulse signals. The number of magnetic pole stages determines the number of pulse signals. , the higher the accuracy.   Hall sensor 2.The relationship between the motor magnetic ring series and the output Hall waveform 5 pole pairs 3.Determination of motor rotation direction         The direction of the motor is judged by the phase difference of the two Hall signals. As shown in the figure below, the phase of Sensor A is ahead of Sensor B, so it can be considered that the current rotation direction of the motor is clockwise.   4.Calculation of motor speed         The speed of the motor can be calculated by the pulse width of the pulse, and the number of revolutions of the motor can be calculated by the number of pulses. Assuming that the Hall magnetic ring of the motor has 5 pairs of poles, it means that there are five pulses in one revolution of the motor, and the speed of the motor = 60 / (t1 * 5) rev/min. The number of pulses can be obtained by the edge capture function of the FTM. Motor speed and stroke         Assuming that the clock of the FTM is 2MHz, then it takes 1/2000000 seconds for the counter to add 1. Since the unit of the motor speed is rpm, the calculation formula of the motor speed is : -> Motor Speed = 60 / (5 * a* (1 / 2000000))         In this formula, '5' is the number of pole pairs of the magnetic ring, and 'a' is the difference of the counter corresponding to the falling edge of two consecutive pules.         Let’s do a test, the square wave in the below figure is the outputs of PTB12, and the output pulse period is 32.1ms. Then the time required for the motor to rotate once should be:32.1ms *5 = 160.5ms, then the speed of the motor should be: 60 * 1000 / 160.5 = 373.83rpm.   PTB2 output square wave          The below picture is directly obtained by the debugger. It can be seen that the speed of the motor at this time is 373, which is not much different from the value measured by the oscilloscope, which is 373.83. This is because I did not use the floating-point calculation result in the program. In summary, we use the input capture function of the FTM module completes the calculation of the motor speed.   debuger monitor results 5.How to calculate the direction of rotation of the motor         Above we calculated the speed of the motor, but did not make judgement on the direction of the rotation of the motor. As mentioned above, the rotation direction of the motor is judged by the phase difference of the two Hall pulse waveforms. Usually, we think of using the timestamp to judge the current state of the phase, so we will enable the two input captures, and then calculate the two Halls timestamp of the falling edge of the pulse.         In fact, there is a simpler method, it only needs to read the high and low state of the other Hall pulse level when the falling edge of one hall pulse is interrupted. In short, we only need to enable one input capture, and the other to be used as a GPIO port.
View full article
Hi all, Recently, we completed S32K Sound Mixer reference code and demo, and glad to share this demo at here.   Some key feature of this demo:  - Demo HW based on S32K344/S32K148 + audio codec SGTL5000 + QSPI flash MX25L6433.  - Demo SW based on S32K3 RTD RTM 2.0.0 and S32K1 RTD RTM 1.0.0.  - Demo provided 2 kinds of sound mixing algorithm realization code, and corresponding audio materials and codec SGTL5000 driver.  - Demo showed how to programming QSPI flash and its AHB accessing via audio storage and playing process.  - Demo used mono audio as source for processing, and output stereo audio (I2S format) via SAI HW FIFO combine (Line_Mux) function with nearly no extra cost.   HMI/Cluster apps need multiple audio sources (usually warning sounds) be played simultaneously, which brings sound mixing ability requirement. However, S32K1/3 lack of this HW/SW feature support. With the demand from local key customer, and considering potential customer requirements, we planned to enable a SW sound mixer with scheduled peripherals, to enhance the S32K family audio mixing ability. It shall be easy of using/porting on S32K1/3, and use QSPI flash (AHB mode read) to store the music. Attachment the Sound Mixer package includes 2 sound mixing examples based on S32K344 EVB and S32K148 T-Box RDB, and some slides to introduce this implementation and quick start guide.    Thanks and welcome any comment from you. Best Regards, Shuailin Li
View full article
Symptoms Recently found the compatibility issue is a troublesome problem especially when we are supporting different version of RTD. Remove/install the RTD SDK and plug, but it is not a perfect way because reinstall the RTD would cause a lot of time, sometimes it is unreliable. Diagnosis After investigated the mechanism of CT and MEX file, and found a work around to let the old project can be run in new version of RTD basis. Solution Already tested it with several reference code and examples of RTD, it can work. Attached is the document.
View full article
Symptoms   Diagnosis   Solution  
View full article
Symptoms   Diagnosis   Solution  
View full article
This article is written in Chinese. It is mainly for the disty and mass market customers in local China. It is useful for the the developers who is newly in touch with S32K1, and will help them install several software of S32K1, otherwise it may waste a lot of time.     S32DS中快速搭建S32K1的开发环境 一.背景 我最近换装了新电脑,需要重新安装S32DS,发现存在很多问题。尤其是对比之前的安装过程,发现官网的很多链接已经失效,甚至有一定的迷惑性。 最新的S32K1安装包比较隐蔽,而且安装存在前后依赖,对于刚接触NXP S32系列的新手非常不友好,所以写这篇文档总结一下典型的问题和解决方法。 同时也希望提供一个check的思路和步骤,在后续新版本发布时,升级IDE的时候更方便找到合适的安装包。 二.S32DS中各个包依赖关系解析 在S32DS中,每一个系列的MCU,总共需要安装两个插件包,一个是基础依赖包,一个是SDK(也叫RTD,同一个意思)。 1.基础依赖包 这个包对应S32DS版本,比如当前的3.4.3,官网可以下载离线版,一般大小在3GB左右,会更新S32DS中的很多组件,如下图1所示:            图1 尤其需要关注图1中红框的内容,没有这个development package的话,是无法进行对应MCU的debug。 图1中安装的包,对应到S32DS中安装的内容如图2所示:            图2 2.RTD安装包(与SDK同义) 这个包对应于RTD版本,也会标识AutoSAR的版本,比如最新的2.0.0,AutoSar 4.4,如图3所示:           图3 基础依赖包与RTD安装包存在前后依赖关系,如果不安装基础依赖包直接安装RTD,在安装时会报错。另外,我们下载的RTD包,即使写明是K3,里面也会包含K1的RTD,这点需要注意。如果此时还没有装K1的development package,就会出错。 三.S32K1开发环境搭建 官网对于S32K3的软件划分为standard software和reference software,其中S32DS和基础依赖包在standard software中,可以很方便的找到。 但S32K1的官网却仅有一个reference software,页面也只能找到几个RTD(或SDK)链接:                                                                             图4 这里面所有的链接都不是我们需要的,全是RTD。问题就出在这里,K1的网页中没有K1的基础依赖包!而前面讲过,缺基础依赖包会导致RTD也无法安装。经过我研究,K1的基础依赖包隐藏的非常深,可以通过两个方法找到: 从S32K1的reference software进去,然后重新点击product list,如下图5所              图5         进入如下页面,如图6所示,这里最能看出来,针对K1的界面很不友好,需要点最底下的NXP Software.              图6 在NXP.com官网首页搜索栏直接搜S32DS,找到S32 Design Studio for S32 Platform(注意不要选成for ARM或或者for PowerPC),从S32DS的主界面进入,然后一直下拉,找到S32DS service pack 1,这个才是K1的,如图7所示:                 图7 这个链接更加隐蔽,要在40多个选项里挨个找。   经过上面两个方法,都可以进入图8所示的界面,然后再按图8所示操作:              图8   这回终于到了最终可以下载S32K1基础依赖包的地方,如图9所示。我们需要重点关注一下命名,SW32开头的,会包含所有S32的development package,包括K1,K3,G;SW32K1开头的,仅有K1,同理如果你在K3的界面中,可以看到SW32K3开头的。            图9 下载最新版本的S32K1基础依赖包,然后再安装RTD,大功告成。
View full article
****************************************************************************************************  Detailed Description:  The current RTD RTM 2.0.0 does not support overflow notification  if EMIOS ICU is used in the Edge Detect mode.  Workaround is to use another channel in ECU mode  clocked by the same counter bus as the ICU channel.  Emios_0 input clock: 48MHz CORE_CLK  MCL EMIOS_0_Ch_23 (BUS_A)  Global clock devider: 48  MCB prescaler: 1  MCB clock: 1MHz  MCB tick: 1us  MCB period: 65_535 ticks  Both OCU (Emios_0_Ch0) and ICU (Emios_0_ch3) use the same BUS_A counter clock.  GPIO generated PWM period: ~0.5s  That's 500_000 ticks  ICU routed to PTB0  GPIO PWM to PTB1  -----------------------------------------------------------------------------------------------  Test HW: S32K3X4EVB-Q172  MCU: S32K344  Debugger: S32DS 3.4, PEMicro Multilink rev.C  Target: internal_FLASH ****************************************************************************************************
View full article
************************************************************************************************************************** * Detailed Description: * * Connect PTC24 (PWM) to PTC25 (IC) * * PWM signal generated by EMIOS_1_ch0 (in OPWFMB mode) is measured by EMIOS_1_ch_1 (IPWM mode). * * EMIOS_1 global global clock (core clock = 48MHz) prescaled in EMIOS_Mcl driver (/48) = 1MHz. * * BUS_A generated by EMIOS_1_ch_23 * Tick = 10us (1MHz global clock prescaled by 10 = 100kHz) * * PWM (OPWFMB), EMIOS_1_ch_0, PTC24 * Tick = 10us (1MHz global clock prescaled by 10 = 100kHz) * * IC (IPWM), EMIOS_1_ch_1, PTC25 * Clocked by BUS_A * Tick = 10us * * ------------------------------------------------------------------------------------------------------------------------ * Test HW: S32K3X4EVB-Q172 * MCU: S32K344 * Debugger: S32DS 3.4, PEMicro Multilink rev.C * Target: internal_FLASH **************************************************************************************************************************
View full article