Code Monkey home page Code Monkey logo

mbed-os-example-nfc's Introduction

Mbed OS NFC examples

This repo contains NFC example applications based on mbed OS and built with Mbed CLI 1 or Mbed CLI 2.

Each example directory prefixed with NFC_ contains an Mbed os project.

The NFC documentation describes the NFC APIs on mbed OS.

Using the examples

Targets for NFC

Supported targets vary for each example. Check README.md in the example's directory for details.

Mbed OS build tools

Mbed CLI 2

Starting with version 6.5, Mbed OS uses Mbed CLI 2. It uses Ninja as a build system, and CMake to generate the build environment and manage the build process in a compiler-independent manner. If you are working with Mbed OS version prior to 6.5 then use Mbed CLI 1. Install Mbed CLI 2.

Mbed CLI 1

Install Mbed CLI 1.

Building the examples

  1. Clone the repository containing the collection of examples:

    $ git clone https://github.com/ARMmbed/mbed-os-example-nfc.git
  2. Using a command-line tool, navigate to any of the example directories, like NFC_EEPROM:

    $ cd mbed-os-example-nfc
    $ cd NFC_EEPROM
  3. Update the source tree:

    • Mbed CLI 2
    $ mbed-tools deploy
    • Mbed CLI 1
    $ mbed deploy
  4. Connect a USB cable between the USB port on the board and the host computer.

  5. Run the following command: this will build the example project, program the microcontroller flash memory, and then open a serial terminal to the device.

    • Mbed CLI 2
    $ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm --baudrate 9600
    • Mbed CLI 1
    $ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash --sterm --baudrate 9600

Your PC may take a few minutes to compile your code.

The binary will be located in the following directory:

  • Mbed CLI 2 - ./cmake_build/<TARGET>/<PROFILE>/<TOOLCHAIN>/
  • Mbed CLI 1 - ./BUILD/<TARGET>/<TOOLCHAIN>/

You can manually copy the binary to the target, which gets mounted on the host computer through USB, rather than using the --flash option.

You can also open a serial terminal separately, as explained below, rather than using the --sterm and --baudrate options.

Running the examples

When the example application is running, information about activity is printed over the serial connection. The default serial baudrate has been set to 9600 for these examples.

If not using the --sterm and --baudrate options when flashing, have a client open and connected to the board. You may use:

  • Mbed CLI 2

     $ mbed-tools sterm -b 9600
  • Mbed CLI 1

     $ mbed sterm -b 9600
  • Tera Term for Windows

  • screen or minicom for Linux

    $ screen /dev/serial/<your board> 9600

Verification of the sample application can be seen on any a smartphone with an NFC reader. After running you will be able to read the tag with an NFC tag reader application.

Known issues

The repository is not meant to be imported directly inside the Mbed online compiler. To import one example inside the online compiler, go to https://os.mbed.com/teams/mbed-os-examples/ and import from here the NFC example of your choice.

License and contributions

The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info.

This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.

mbed-os-example-nfc's People

Contributors

0xc0170 avatar adbridge avatar apalmierigh avatar gpsimenos avatar hugueskamba avatar mbedmain avatar pan- avatar patater avatar paul-szczepanek-arm avatar rajkan01 avatar rwalton-arm avatar saheerb avatar urutva avatar wernerlewis avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbed-os-example-nfc's Issues

NFC_EEPROM example fails to build for DISCO_L475VG_IOT01A

Description of defect

$ mbedtools compile -t GCC_ARM -m DISCO_L475VG_IOT01A -b develop
Configuring project and generating build system...
-- Configuring done
-- Generating done
-- Build files have been written to: /Code/github.com/ARMmbed/mbed-os-example-nfc/NFC_EEPROM/cmake_build
Building Mbed project...
[4/285] Building CXX object CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj
FAILED: CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj 
arm-none-eabi-g++ @CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj.rsp -MD -MT CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj -MF CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj.d -o CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp.obj -c ../EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp
../EEPROMDriver/target/TARGET_M24SR/EEPROMDriver.cpp:18:10: fatal error: m24sr_driver.h: No such file or directory
   18 | #include "m24sr_driver.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
[13/285] Building CXX object CMakeFiles/NFC_EEPROM.dir/EEPROMDriver/target/NfcControllerToEEPROMAdapter.cpp.obj
ninja: build stopped: subcommand failed.
ERROR: CMake invocation failed!

More information may be available by using the command line option '-v'.

Target(s) affected by this defect ?

DISCO_L475VG_IOT01A

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM

What version of Mbed-os are you using (tag or sha) ?

5f541b22d092

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-tools

How is this defect reproduced ?

mbedtools compile -t GCC_ARM -m DISCO_L475VG_IOT01A -b develop

[OoB_5.10]: Smart Poster app.. what is expected?

After building the app with GCC_ARM and flashing to the device, on the serial terminal, the following output is seen:

Initialize: ret = 0
Start Discovery: ret = 0
Initiator discovered
Connected
Discovery terminated: 0
Disconnected
Initiator discovered
Connected
Discovery terminated: 0
Disconnected
Initiator discovered
Connected
Discovery terminated: 0
Disconnected

I'm not sure what is expected from the Android phone as nothing happens on the app and there is not enough documentation in the repo's README to show expected outcome.
cc @donatieng @pan- ..

NFC_SmartPoster CMake build fails with `../../../../source/main.cpp:22:10: fatal error: nfc/controllers/PN512Driver.h: No such file or directory`

Description of defect

#### STDERR ####

#### End of STDOUT/STDERR ####

IMAGE is /builds/workspace/mbed-os-ci_cmake-example-GCC_ARM-dev@11/examples/mbed-os-example-nfc/NFC_EEPROM/cmake_build/DISCO_L475VG_IOT01A/develop/GCC_ARM/NFC_EEPROM.bin
[EXAMPLES]> INFO     In folder 'mbed-os-example-nfc/NFC_SmartPoster'
[EXAMPLES]> INFO     Compiling mbed-os-example-nfc/NFC_SmartPoster DISCO_L475VG_IOT01A GCC_ARM
[EXAMPLES]> INFO     Executing command 'mbed-tools compile -t GCC_ARM -m DISCO_L475VG_IOT01A -c'...

#### STDOUT ####
Configuring project and generating build system...
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: /usr/bin/python3.7 (found version "3.7.4") found components: Interpreter 
-- Checking for Python package prettytable -- found
-- Checking for Python package future -- found
-- Checking for Python package jinja2 -- found
-- Checking for Python package intelhex -- found
-- Configuring done
-- Generating done
-- Build files have been written to: /builds/workspace/mbed-os-ci_cmake-example-GCC_ARM-dev@11/examples/mbed-os-example-nfc/NFC_SmartPoster/cmake_build/DISCO_L475VG_IOT01A/develop/GCC_ARM
Building Mbed project...
[1/297] Link line:
[2/297] Building ASM object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/irq_cm4f.S.obj
[3/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config/RTX_Config.c.obj
[4/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_lib.c.obj
[5/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_evr.c.obj
[6/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj
FAILED: CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj 
/usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++ @CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj.rsp -MD -MT CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj -MF CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj.d -o CMakeFiles/NFC_SmartPoster.dir/source/main.cpp.obj -c ../../../../source/main.cpp
../../../../source/main.cpp:22:10: fatal error: nfc/controllers/PN512Driver.h: No such file or directory
   22 | #include "nfc/controllers/PN512Driver.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[7/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Library/cmsis_os1.c.obj
[8/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/stm32l4xx_hal_dfsdm_ex.c.obj
[9/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/stm32l4xx_hal_dma2d.c.obj
[10/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/SmartPoster/SmartPoster.cpp.obj
[11/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/Source/os_tick_ptim.c.obj
[12/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj
[13/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/Source/os_systick.c.obj
[14/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/device/rtos/TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c.obj
[15/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/stm32l4xx_hal_dcmi.c.obj
[16/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_memory.c.obj
[17/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_system.c.obj
[18/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/device/rtos/source/mbed_rtos_rtx.c.obj
[19/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_evflags.c.obj
[20/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/device/rtos/source/mbed_boot.c.obj
[21/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_mempool.c.obj
[22/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/device/rtos/source/mbed_rtx_handlers.c.obj
[23/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_timer.c.obj
[24/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_semaphore.c.obj
[25/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_mutex.c.obj
[26/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_kernel.c.obj
../../../../mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_kernel.c: In function 'svcRtxKernelInitialize':
../../../../mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_kernel.c:93:3: warning: 'memset' offset [17, 164] from the object at 'osRtxInfo' is out of the bounds of referenced subobject 'kernel' with type 'struct <anonymous>' at offset 8 [-Warray-bounds]
   93 |   memset(&osRtxInfo.kernel, 0, sizeof(osRtxInfo) - offsetof(osRtxInfo_t, kernel));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[27/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/DigitalInOut.cpp.obj
[28/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_msgqueue.c.obj
[29/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/DigitalIn.cpp.obj
[30/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/DigitalOut.cpp.obj
[31/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/SPISlave.cpp.obj
[32/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/targets/TARGET_STM/TARGET_STM32L4/STM32Cube_FW/STM32L4xx_HAL_Driver/stm32l4xx_hal_dfsdm.c.obj
[33/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/AnalogOut.cpp.obj
[34/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/BusOut.cpp.obj
[35/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/BusIn.cpp.obj
[36/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/BusInOut.cpp.obj
[37/297] Building C object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_thread.c.obj
[38/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/cmsis/device/rtos/source/mbed_rtx_idle.cpp.obj
[39/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/AnalogIn.cpp.obj
[40/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/CAN.cpp.obj
[41/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/FlashIAP.cpp.obj
[42/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/I2C.cpp.obj
[43/297] Building CXX object CMakeFiles/NFC_SmartPoster.dir/mbed-os/drivers/source/BufferedSerial.cpp.obj
ninja: build stopped: subcommand failed.

#### STDERR ####
ERROR: CMake invocation failed!

More information may be available by using the command line option '-v'.

Target(s) affected by this defect ?

DISCO_L475VG_IOT01A

Toolchain(s) (name and version) displaying this defect ?

GCC_ARM

What version of Mbed-os are you using (tag or sha) ?

9bbc8c914c7e

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

Mbed CLI 2

How is this defect reproduced ?

mbed-tools compile -t GCC_ARM -m DISCO_L475VG_IOT01A -c

Infinite loop in init

When running the example on a Nucleo L476 with a PN512 board, nfc_process.init() appears to enter an infinite loop, and returns neither an error neither success.

[5.14-OOB] mbed-os-example-nfc\NFC_SmartPoster failed when building with Online compiler

Board: DISCO_L475VG_IOT01A
Log output:

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0   : 20001FE8
R1   : 00000000
R2   : 08007855
R3   : 08006A61
R4   : 00000000
R5   : 080139E0
R6   : 080139D0
R7   : 080139B0
R8   : 20001838
R9   : 00000000
R10  : 00000000
R11  : 00000000
R12  : 08012671
SP   : 20001820
LR   : 0800C279
PC   : 080076EE
xPSR : 61000000
PSP  : 200017B8
MSP  : 20017FD8
CPUID: 410FC241
HFSR : 40000000
MMFSR: 00000082
BFSR : 00000000
UFSR : 00000000
DFSR : 00000008
AFSR : 00000000
MMFAR: 00000070
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --



++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x800C3FB
Error Value: 0x80076EE
Current Thread: main  Id: 0x200020F8 Entry: 0x800C9FD StackSize: 0x1000 StackMem: 0x200010F8 SP: 0x20017F70 
For more info, visit: https://armmbed.github.io/mbedos-error/?error=0x80FF013D
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=2) reached maximum, system will halt after rebooting 

I'm not sure how to get ELF or MAP-files out of online compiler so I didn't run crash_log_parser.py

[5.10-OOB] mbed-os-example-nfc\NFC_EEPROM failed when building with IAR compiler

mbed-os-example-nfc\NFC_EEPROM failed, when the example built with IAR compiler.
NFC tag can not be readd by an NFC reader APP on iphone.
the NFC tag can be read when the example code built with ARM compiler.

Building command
mbed compile -t IAR -m DISCO_L475VG_IOT01A -f -c

failed to write (error: 16)
failed to read (error: 16)
Building an ndef message
failed to write (error: 16)
failed to read (error: 16)
Building an ndef message
failed to write (error: 16)
failed to read (error: 16)

APP on iphone
NFC TagInfo provided by NXP.

[5.14-OOB] mbed-os-example-nfc\NFC_SmartPoster failed when building with IAR compiler

Board: DISCO_L475VG_IOT01A
Build command: mbed compile -m DISCO_L475VG_IOT01A -t IAR --flash --clean
Log Output:

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0   : 20001328
R1   : 00000000
R2   : 08003C21
R3   : 080110F4
R4   : 00000000
R5   : 00000000
R6   : 00000000
R7   : 00000000
R8   : 00000000
R9   : 00000000
R10  : 00000000
R11  : 00000000
R12  : 08001C59
SP   : 20000B68
LR   : 0800234B
PC   : 08003AD0
xPSR : 01000000
PSP  : 20000B48
MSP  : 10007F10
CPUID: 410FC241
HFSR : 40000000
MMFSR: 00000082
BFSR : 00000000
UFSR : 00000000
DFSR : 00000008
AFSR : 00000000
MMFAR: 00000074
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --



++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x0
Error Value: 0x8003AD0
Current Thread: main  Id: 0x200003B8 Entry: 0x80019F5 StackSize: 0x1000 StackMem: 0x20000418 SP: 0x10007EB0 
For more info, visit: https://armmbed.github.io/mbedos-error/?error=0x80FF013D
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=1) reached maximum, system will halt after rebooting =

crash_log_parser.py

Crash Info:
	Crash location = mbed::nfc::NFCController::start_discovery() [0x08003AD0] (based on PC value)
	Caller location = main [0x0800234B] (based on LR value)
	Stack Pointer at the time of crash = [20000B68]
	Target and Fault Info:
		Processor Arch: ARM-V7M or above
		Processor Variant: C24
		Forced exception, a fault with configurable priority has been escalated to HardFault
		Data access violation. Faulting address: 00000074

NFC_EEPROM sample write does not take effect on NUCLEO-L433RC-P + X-NUCLEO-NFC04A1

Description of defect

After building the NFC_EEPROM sample for the Nucleo-L433RC-P dev board with the Nucleo-NFC04A1 expansion, the sample compiles and runs, but while it claims to successfully write a message, the message in the EEPROM is not modified.

The following was added to mbed_app.json in target_overrides:

        "NUCLEO_L433RC_P": {
            "target.extra_labels_add": ["ST25DV"],

After compiling and flashing, the following output is observed:

Building an ndef message
message written successfully
Received an ndef message of size 20
message read successfully

However, the message when read by a smartphone remains unchanged - and no matter the URL set in the source, the length read back is always 20.

Target(s) affected by this defect ?

NUCLEO-L433RC-P + X-NUCLEO-NFC04A1

Toolchain(s) (name and version) displaying this defect ?

Arm Compiler 6

What version of Mbed-os are you using (tag or sha) ?

6.15.1

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

None

How is this defect reproduced ?

  1. Download this repository and open it as a workspace in Mbed Studio
  2. Select the NFC_EEPROM project as active
  3. Make the changes described above to mbed_app.json
  4. Compile and run the app.

Question: How to respond to interrupts in SYNC mode?

Hi there,

I'm using the NFC_EEPROM example code from the latest commit alongside the latest version of the M24SR NFC EEPROM driver provided here.

I have the program compiling and writing the mbed.com URI to the chip, this is then readable using a variety of NFC applications on an Android phone, I'm using ST25. This is currently using SYNC mode. If I use ASYNC mode the application hangs, presumably waiting for a callback that never triggers (?), after printing Building an ndef message. I did follow the advice in this comment regarding the setup of the device into ASYNC mode to no avail.

With the above as context - I'm having trouble figuring out exactly how to respond to interrupts from the M24SR and trigger actions based on that. For example, is there a callback function that exists when an NDEF record is modifed, added or deleted? If so, how would I go about invoking it? which GPO mode would be best suited? I believe either WIP or SESSION_OPENED?

I mentioned that the application is currently running using SYNC mode - this isn't a hard requirement for me and working in ASYNC mode would have some benefits.

I've been struggling with this for a while now and any insight would be greatly appreciated.

I've even tried setting up an InterruptIn on the GPO pin and manually responding to interrupts that way. I can at least detect interrupts but figuring out which functions to call/how to read data from the EEPROM is beyond me.

All the best,
Adam

[OoB_6.0] The smartposter app crashes on DISCO_L475VG_IOT01A

After running :

git clone https://github.com/ARMmbed/mbed-os-example-nfc.git
cd mbed-os-example-nfc/NFC_SmartPoster
mbed deploy
mbed compile -t GCC_ARM -m detect

The application crashes with :

++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8001DB4
Error Value: 0x10000188
Current Thread: main Id: 0x20001068 Entry: 0x8007351 StackSize: 0x1000 StackMem: 0x20001A88 SP: 0x20002220 
For more info, visit: https://mbed.com/s/error?error=0x80FF013D&tgt=DISCO_L475VG_IOT01A
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=4) reached maximum, system will halt after rebooting =Initialize: ret = 16

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0: 200029E8
R1: A
R2: 8001E75
R3: 0
R4: 0
R5: 800EE4C
R6: 20002244
R7: 800EE7C
R8: 800EE6C
R9: 0
R10: 0
R11: 0
R12: 0
SP   : 20002220
LR   : 800085D
PC   : 8001DB4
xPSR : 1000000
PSP  : 200021B8
MSP  : 10000648
CPUID: 410FC241
HFSR : 40000000
MMFSR: 82
BFSR : 0
UFSR : 0
DFSR : 8
AFSR : 0
MMFAR: 70
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler -

[5.14-OOB] mbed-os-example-nfc\NFC_SmartPoster failed when building with GCC_ARM compiler

Board: DISCO_L475VG_IOT01A
Build command: mbed compile -m DISCO_L475VG_IOT01A -t GCC_ARM --flash --clean
Log output:

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R0   : 200029C0
R1   : 00000000
R2   : 08001F79
R3   : 00000000
R4   : 00000000
R5   : 0801344C
R6   : 0801343C
R7   : 200021B4
R8   : 0801341C
R9   : 00000000
R10  : 00000000
R11  : 00000000
R12  : 00000000
SP   : 20002190
LR   : 080008B3
PC   : 08001EC8
xPSR : 210F0000
PSP  : 20002128
MSP  : 10007FC0
CPUID: 410FC241
HFSR : 40000000
MMFSR: 00000082
BFSR : 00000000
UFSR : 00000000
DFSR : 00000008
AFSR : 00000000
MMFAR: 00000070
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --



++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8000B33
Error Value: 0x8001EC8
Current Thread: main  Id: 0x20001A24 Entry: 0x8006FCB StackSize: 0x1000 StackMem: 0x20001A68 SP: 0x10007F58 
For more info, visit: https://armmbed.github.io/mbedos-error/?error=0x80FF013D
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=1) reached maximum, system will halt after rebooting =

crash_dump analysis

Crash Info:
	Crash location = mbed::nfc::NFCController::start_discovery() [0x08001EC8] (based on PC value)
	Caller location = main [0x080008B3] (based on LR value)
	Stack Pointer at the time of crash = [20002190]
	Target and Fault Info:
		Processor Arch: ARM-V7M or above
		Processor Variant: C24
		Forced exception, a fault with configurable priority has been escalated to HardFault
		Data access violation. Faulting address: 00000070

addr2line

$ arm-none-eabi-addr2line -e BUILD/DISCO_L475VG_IOT01A/GCC_ARM/NFC_SmartPoster.elf -a 0x080008B3
0x080008b3
mbed-os-example-nfc/NFC_SmartPoster/./main.cpp:174

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.