NFC and ndef2t

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,764件の閲覧回数
CyrilBZH
Contributor I

Hello,

 

I'm using an NHS3152 evaluation board (with LPC-Link2 board).

I'm trying to use the NFC communication. I used parts of codes I found on the community forums.

I have it seems a set up problem as there is no link to the ndeft2t/ndeft2.h. When I build or debug my short project, I have this error :

09:53:57 **** Build of configuration Debug for project Essai_Prog ****
make -r -j4 all
Building file: ../src/mainEssai_Prog.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -DDEBUG -D__CODE_RED -DCORE_M0PLUS -D__REDLIB__ -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\Essai_Prog\inc" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_board_dp\inc" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_chip_nss\inc" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\mods" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\Essai_Prog\mods" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_board_dp\mods" -I"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_chip_nss\mods" -include"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\Essai_Prog\mods\app_sel.h" -include"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_board_dp\mods\board_sel.h" -include"C:\Users\clahuec\Documents\MCUXpressoIDE_10.2.1_795\workspace\lib_chip_nss\mods/chip_sel.h" -O0 -fno-common -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0plus -mthumb -specs=redlib.specs -MMD -MP -MF"src/mainEssai_Prog.d" -MT"src/mainEssai_Prog.o" -MT"src/mainEssai_Prog.d" -o "src/mainEssai_Prog.o" "../src/mainEssai_Prog.c"
../src/mainEssai_Prog.c:9:10: fatal error: ndeft2t/ndeft2.h: No such file or directory
#include "ndeft2t/ndeft2.h" // pour message NFC
^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [src/mainEssai_Prog.o] Error 1

 

Here is the program:

//Programme pour lire données provenant du NHS3152 sur un lecteur RFIDRC522
// 1er essai: générer avec le DAC une tension continue de 1.3V sur la broche ANA0_1 quand le champ NFC est détecté
// inspiré de https://community.nxp.com/t5/NFC/Transmission-of-an-int-with-NDEF-NHS3152/m-p/849113
#include <string.h>
#include <stdlib.h>
#include <stdio.h> // contains sprintf function (needs to be included to avoid : https://stackoverflow.com/questions/8440816/warning-implicit-declaration-of-function
/*#include "msghandler.h"*/
#include "board.h"
#include "ndeft2t/ndeft2.h" // pour message NFC

/* ------------------------------------------------------------------------- */

/*#define LOCALE "en" /**< Language used when creating TEXT records. */
*/#define MIME "nhs31xx/example.ndef" /**< Mime type used when creating MIME records. */

/** The text will be used in a single-record NDEF message.
#define MAX_URI_PAYLOAD (254 - NDEFT2T_MSG_OVERHEAD(true, NDEFT2T_URI_RECORD_OVERHEAD(true)))
static const uint8_t sUrl[MAX_URI_PAYLOAD + 1 /* NUL */] = "ceci est un message";*/

static bool sState;
static volatile bool sFieldPresent = false; /** @c true quand champ NFC détecté et tag sélectionné. */

int adcInput=123456789; /*définit une constante représentant la sortie de l'ADCpar ex */
char str_adcInput[16]; /* stock la chaine de caractère */

void App_FieldStatusCb(bool status)
{
if (status) {
LED_On(LED_RED);
}
else {
LED_Off(LED_RED);
}
sFieldPresent = status; /* Handled in main loop */
}

void SendNDEFMessageToMem (void)
{
// 3. Sending the NDEF message to the common memory
uint8_t instanceBuffer[NDEFT2T_INSTANCE_SIZE] __attribute__((aligned (4)));
uint8_t messageBuffer[NFC_SHARED_MEM_BYTE_SIZE ] __attribute__((aligned (4)));
NDEFT2T_CREATE_RECORD_INFO_T createRecordInfo;
uint8_t locale[] = "en";
uint8_t payloadText[16];
strcpy((char *)payloadText,(const char *)str_adcInput);
}


//Function pour initialiser le DAC et génerer 1.3V
void DAC_output(float voltage_out, int native_voltage_value)
{
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_1, IOCON_FUNC_1); // IOCON_FUN_1
Chip_ADCDAC_Init(NSS_ADCDAC0);
Chip_ADCDAC_SetMuxDAC(NSS_ADCDAC0, ADCDAC_IO_ANA0_1);
Chip_ADCDAC_SetModeDAC(NSS_ADCDAC0, ADCDAC_CONTINUOUS);
//Actual DAC output voltage is Vout = (native/2881)V + 0.262V
native_voltage_value = 2881*(voltage_out - 0.262);
Chip_ADCDAC_WriteOutputDAC(NSS_ADCDAC0, native_voltage_value);
}

int main(void)
{
Board_Init();

// TODO: insert code here
Chip_Clock_System_BusyWait_ms(1000);
int adcInput=123456789;

// 2. Conversion int to hexadecimal string
char str_adcInput[16];
itoa(adcInput, str_adcInput, 10);

// 3. Sending the NDEF message to the common memory
uint8_t instanceBuffer[NDEFT2T_INSTANCE_SIZE] __attribute__((aligned (4)));
uint8_t messageBuffer[NFC_SHARED_MEM_BYTE_SIZE] __attribute__((aligned (4)));
NDEFT2T_CREATE_RECORD_INFO_T createRecordInfo;
uint8_t locale[] = "en";
uint8_t payloadText[16];
strcpy((char *)payloadText,(const char *)str_adcInput);
/* Ensure initialization of the NFC HW block is done first. This needs to be done only once.
* Any previously written NDEF message will be lost as the NFC shared memory will be re-initialized.
*/
Chip_NFC_Init(NSS_NFC);
NDEFT2T_Init(); /* Required once, not for every message creation or parsing. */
NDEFT2T_CreateMessage((void*)instanceBuffer, messageBuffer, NFC_SHARED_MEM_BYTE_SIZE, true);
createRecordInfo.shortRecord = 1; /* Enable Short record */
createRecordInfo.pString = locale;
if (NDEFT2T_CreateTextRecord((void*)instanceBuffer, &createRecordInfo)) {
/* The payload length to pass excludes the NUL terminator. */
if (NDEFT2T_WriteRecordPayload((void*)instanceBuffer, payloadText, sizeof(payloadText) - 1)) {
NDEFT2T_CommitRecord((void*)instanceBuffer);
}
}
NDEFT2
T_CommitMessage((void*)instanceBuffer);

return 0;
}

 

Here is an imùage of my MCUXpresso 

Capture_nfc2.PNG

 

I fail to see why it does not find that file

thanks for your help

0 件の賞賛
返信
1 解決策
2,745件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi,

please check the project properties.  the include path, 

danielchen_0-1672839473824.png

 

Regards

Daniel

 

元の投稿で解決策を見る

0 件の賞賛
返信
7 返答(返信)
2,724件の閲覧回数
CyrilBZH
Contributor I

Dear Daniel,

ok I have the paths listed in your picture (see image below)

One of the already included the ndeft2t files ("${workspace_loc:/modes}) 

nevertheless, I explicitly gave the the full path  the files.

I also included the files in the Inlude File section.

CyrilBZH_1-1673278888803.png

The error is not the same, in this sense it corrected the initila error).

Here ar ethe errors I now have

CyrilBZH_2-1673279117950.png

Any suggestion?

regards

Cyril

 

0 件の賞賛
返信
2,723件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi @CyrilBZH :

 

The error message is 'no rule to make target', please refer to below link, the reason might be the same.

https://www.microchip.com/forums/m782630.aspx

 

Regards

Daniel

0 件の賞賛
返信
2,756件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

I can see ndeft2t.h is in NHS3152 SDK, release_mra2_nhs33152, maybe you need to check the project include path.

 

Regards

Daniel

0 件の賞賛
返信
2,749件の閲覧回数
CyrilBZH
Contributor I

Hello Daniel,

I'm not yet familiar with the tool MCUXpresso.

I'm certainly missing a link, a path to the ndeft2t.h file. But looking at my project explorer you can see that I have the ndeft2t folder listed in "mods".

CyrilBZH_0-1672838528898.png

 

 

Maybe I need it elswhere. but don't see where / how to add it. If you can enlight me...

best regards

Cyril

0 件の賞賛
返信
2,743件の閲覧回数
CyrilBZH
Contributor I

ok,

I added that line:

CyrilBZH_0-1672842488093.png

to provide a path where the ndeft2t.h file was.

it seems to have done the work, I don't have the error anymore.

Thanks

Cyril

0 件の賞賛
返信
2,746件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi,

please check the project properties.  the include path, 

danielchen_0-1672839473824.png

 

Regards

Daniel

 

0 件の賞賛
返信
2,717件の閲覧回数
CyrilBZH
Contributor I
Hi Daniel,

ok, I now have things working. The way I included the ndeft2t in my project was not correct.
Thanks
0 件の賞賛
返信