HI ,
I am looking for more information regarding the class of the TRNG but i am not able to find any document. I need detailed information regarding the class like DRG3 , DRG4 for TRNG so that i can know which one i have to use for the CMAC key generation.
Kindly provide me the document.
Solved! Go to Solution.
Working project is attached.
There were swapped parameters in GetRngNum. And I forced needed objects to noncacheable area.
Best Regards,
Lukas
search for rngClass keyword in both HSE-B Firmware Reference Manual and also in S32K312_HSE_Service_API_Reference_Manual which can be found in HSE FW package.
Regards,
Lukas
Hi Lucas,
I am trying to generate the Random number generation but its not working and giving back the response that the feature is not supported (HSE_SRV_RSP_NOT_SUPPORTED).
This is caused by data cache, most likely. To confirm it, you can simply turn off the data cache and it should work. To solve it, all the data structures used for communication with HSE via MU need to be forced to non-cacheable memory.
Regards,
Lukas
HI Lucas,
Can you please explain how to turn off this data cache?
And how to do all the data structures used for communication with HSE via MU need to be forced to non-cacheable memory ?
please explain with some images.
Data cache can be disabled by DC bit in CCR ARM core register:
https://developer.arm.com/documentation/dui0646/b/Bhcjabhi
You can take a look at Crypto examples like:
c:\NXP\S32DS.3.5\S32DS\software\PlatformSDK_S32K3\RTD\Crypto_43_HSE_TS_T40D34M40I0R0\examples\S32DS\S32K3XX\Hse_Ip_AesEncAsyncIrq_S32K344\src\main.c
You can find something like this in the LOCAL VARIABLES section (there are more similar definitions for different type of objects):
Regards,
Lukas
Hi Lucas,
I did same as you suggested, please look into the images attached. But still its not wotking, kindly provide any working code or try at your end, kindly reply on urgent basis. I have also attached main file.I am working with IAR with A_B swap memory of HSE
response i am getting from the code below.
#define HSE_SRV_RSP_NOT_SUPPORTED ((hseSrvResponse_t)0xAA55A11EUL) /**< @brief The operation or feature not supported. */
Working project is attached.
There were swapped parameters in GetRngNum. And I forced needed objects to noncacheable area.
Best Regards,
Lukas
Hi Lucas,
There are two apis available to communicate to HSE via host.
hseStatus = Crypto_Hse_SendMsg from RTD
hseStatus = HSE_Send from the hse_host.c HSE demo example code
Both has different parameters and the RTD one has too many parameter, can you please suggest which one we should use ?
Also we are developing our code with the help of config tool for compliance with Autosar.
Please reply and also try to resolve the TRNG issue.
I tried to turn off the data cache as a first step:
And I can see that the random number is generated:
So, this confirms it's caused by the cache. I can see that you only copied the definitions from the example. But this does not solve the problem. If you take a look at the function:
... there are local variables used for communication with the HSE via MU and the stack is obviously cacheable because it does not work.
HSE DEMO EXAMPLES is non-autosar code. If you need to be autosar compliant, it will be necessary to use Crypto layer in RTD. You can take a look Crypto examples in RTD - examples with "Crypto_" prefix.
Regards,
Lukas
I have some troubles to open the project and I can't spend so much time with this. But what I would try:
There are following variables in GetRngNum() used as inputs for HSE: pHseSrvDesc and pGetRndSrv.
To force them to no-cacheable area, you can define them as global variables and use:
#define CRYPTO_43_HSE_START_SEC_VAR_SHARED_CLEARED_UNSPECIFIED_NO_CACHEABLE
See the example in RTD which shows how to do that exactly:
And then do the same for RandomNumber array in main.c file.
Regards,
Lukas
Hi Lucas,
what is the problem you are getting to open this project? Please let me know?
I tried in main and rng.c file but still its not working. please share at least the main file after modification if possible
and i tried in rng.c file
Hi Lucas,
Kindly help, this RNG is pending from many days and project is lagging behind, kindly help, once its done other things i will take care.
HI Lucas,
I am compiling one of the project from RTD package about the crypto but i am facing a issue that while it is going into the debug it goes into the erasing the chip wait for some time and then it suspended due to time out. this is happening with other projects too.
this board was flashed with the HSE FW with linker file.
kindly find the logs of console below
Initializing.
Soft reset failed!
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_5.1.7.202112141853\win32\gdi\P&E\supportFiles_ARM\NXP\S32K3xx\nxp_s32k312_1x32x500k_hse_disabled.arp
Initializing.
Soft reset failed!
Initialized.
;version 1.00, 08/27/2021, Copyright 2021 P&E Microcomputer Systems, www.pemicro.com [S32K3x2_hse_disabled]
;device nxp, s32k312, 1x32x500k,desc=hse_disabled
;begin_cs device=$00400000, length=$001F4000, ram=$20400000
Loading programming algorithm ...
WARNING - Selected .ARP file has been modified. CRC16 = $ACE3
Done.
Programming sequency is : erase, blank check, program, and verify {default}
CMD>VC
Command is inactive for this .ARP file.
VC is not implemented, falling back to VM
CMD>VM
Verifying.
Verify error at address $00400000.
Byte in module is $FF and should be $A5.
Current content of flash does not match application to be programmed
CMD>EM
Erasing.
Could not connect to semihosting port due to connection timeout. Please check that the correct port number is configured.
Hi Lucas , thank you for your support.
i have used the crypto example code for s32k312 from rtd 4.4 2.0.3 and added all the folder services, interface, drivers and framework and trying to use this project for development purpose, but i am stuck in some hardfault and i am not able to resolve.
kindly help and find the attached project.
loges are beow.
Connection from "127.0.0.1" via 127.0.0.1. Connection from port "53301" to 6224
Connection from "127.0.0.1" via 127.0.0.1. Connection from port "53308" to 7224
Telnet server running on 127.0.0.1:51794
Searching for Kernel Symbols...
rsp_qC - qSymbol: 5F74785F7468726561645F63757272656E745F707472
_tx_thread_current_ptr not found. ThreadX analysis not enabled.
rsp_qC - qSymbol: 707843757272656E74544342
pxCurrentTCB not found. FreeRTOS analysis not enabled.
Unable to load libusb0.dll
Copyright 2021 P&E Microcomputer Systems,Inc.
Command Line :C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_5.1.7.202112141853\win32\pegdbserver_console -device=NXP_S32K3xx_S32K312 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=USBMULTILINK -speed=5000 -port=U¨
PEmicro Interface detected - Flash Version 11.13
CMD>RE
Initializing.
Soft reset failed!
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_5.1.7.202112141853\win32\gdi\P&E\supportFiles_ARM\NXP\S32K3xx\nxp_s32k312_1x32x424k_ab_swap.arp
Initializing.
Soft reset failed!
Initialized.
;version 1.00, 08/27/2021, Copyright 2021 P&E Microcomputer Systems, www.pemicro.com [S32K3x2_ab_swap]
;device nxp, s32k312, 1x32x424k,desc=ab_swap
;begin_cs device=$00400000, length=$001D4000, ram=$20400000
Loading programming algorithm ...
WARNING - Selected .ARP file has been modified. CRC16 = $E7CD
Done.
Programming sequency is : erase, blank check, program, and verify {default}
CMD>VC
Command is inactive for this .ARP file.
VC is not implemented, falling back to VM
CMD>VM
Verifying.
Verified.
Application verified in memory. No need to reprogram.
CMD>RE
Initializing.
Soft reset failed!
Target has been RESET and is active.
Soft reset failed!
Starting reset script (C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_5.1.7.202112141853\win32\gdi\P&E\supportFiles_ARM\NXP\S32K3xx\S32K312.mac) ...
REM Enable clocks for selected cores in MC_ME module (the sequence below enables all clocks).
REM Initialize RAM and DMA:
REM Initialize DMA TCD:
REM Copy valid executable code to RAM for each core to be used.
REM Enable required cores in MC_ME:
Delaying for 20mS ...
Done.
Reset script (C:\NXP\S32DS.3.5\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_5.1.7.202112141853\win32\gdi\P&E\supportFiles_ARM\NXP\S32K3xx\S32K312.mac) completed.
BusFault: An imprecise (asynchronous) data access error has occurred.
HardFault: A fault has been escalated to a hard fault.
Hi Lucas,
Before adding these folders services, framework, interface and drivers to the project, the mcal configuration was having no errors but after adding these folders to the projects the mcal configuration is having the errors. please find the attached image. kindly help for hard fault. you can this project i have already attached in previous message.
If possible provide some time or invite to discuss, can be half an hour call, i need to clarify many things.
A couple of things:
- the error "Processor..." was caused by missing .settings folder. I added the folder from another project and the problem disappeared.
- then there were some issues with paths. Not sure why but I fixed it using "workspace" paths like this:
- and the hard fault was caused by linker file:
There's only 96KB RAM, so it ends at 0x20417FFF.
Regards,
Lukas