Arduino board run on Mbed-os6.8.1 (only test purpose not official). Need Mbed Studio(1.3.1) not online compiler. If you compile on the online compiler, you can get a hex file but it does NOT work!!!
Dependencies: APDS_9960 LPS22HB LSM9DS1 HTS221
1) DAPLink(LPC11U35)の準備
使用したボード →https://akizukidenshi.com/catalog/g/gK-12144/
プログラムは、nRF52840-MDK用に公開されているDAPLinkのコンパイル済のバイナリコードを使わせていただきました。
https://github.com/makerdiary/nrf52840-mdk/tree/master/firmware/daplink
LPC11U35への書込みは、SW1(ISP)を押したままSW2(RESET)を操作するとPCに「CRP DISABLD」という名称でマウントされるので、書込まれているfirmware.binを削除してから、上記のbinファイルをコピーすれば書き込みが行われます。
書込み完了後にSW1を押さずに起動すれば、「DAPLINK」として認識されます。
DETAILS.TXTでDAPLinkの内容を確認できます。
2) 接続
Arduino Nano 33 BLE Sense | LPC11U35 Interface CPU | コメント |
J3:Pin2 (ボード裏のパッド) | CN1:Pin3 P0_7 | SWDIO |
J3:Pin3 (ボード裏のパッド) | CN1:Pin4 P0_8 | SWCLK |
JP2:Pin14 GND | CN2:Pin1 GND | GND |
3)USBSerial
シリアル出力は、NANO 33 BLE SENSEボードのUSB端子経由で出力されます。
4)Mbed Studio 1.3.1を使って開発のこと!(オンラインコンパイラでは動作しません!)
5)ボードピン配置
1_check_I2C_devices/main1.cpp@2:9ee17e6e5900, 2021-02-28 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Feb 28 23:49:07 2021 +0000
- Revision:
- 2:9ee17e6e5900
- Parent:
- 1:cce280da16d4
change comments in select_example.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:f1a10797d9f6 | 1 | /* |
kenjiArai | 0:f1a10797d9f6 | 2 | * Mbed Application program |
kenjiArai | 1:cce280da16d4 | 3 | * Nano 33 BLE Sense board runs on mbed-OS6 |
kenjiArai | 0:f1a10797d9f6 | 4 | * Check I2C control line |
kenjiArai | 0:f1a10797d9f6 | 5 | * |
kenjiArai | 1:cce280da16d4 | 6 | * Copyright (c) 2020,'21 Kenji Arai / JH1PJL |
kenjiArai | 0:f1a10797d9f6 | 7 | * http://www7b.biglobe.ne.jp/~kenjia/ |
kenjiArai | 0:f1a10797d9f6 | 8 | * https://os.mbed.com/users/kenjiArai/ |
kenjiArai | 0:f1a10797d9f6 | 9 | * Started: January 22nd, 2020 |
kenjiArai | 1:cce280da16d4 | 10 | * Revised: February 28th, 2021 |
kenjiArai | 0:f1a10797d9f6 | 11 | */ |
kenjiArai | 0:f1a10797d9f6 | 12 | |
kenjiArai | 0:f1a10797d9f6 | 13 | // Pre-selection -------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 14 | #include "select_example.h" |
kenjiArai | 0:f1a10797d9f6 | 15 | //#define EXAMPLE_1_CHECK_I2C_DEVICES |
kenjiArai | 0:f1a10797d9f6 | 16 | #ifdef EXAMPLE_1_CHECK_I2C_DEVICES |
kenjiArai | 0:f1a10797d9f6 | 17 | |
kenjiArai | 0:f1a10797d9f6 | 18 | // Include -------------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 19 | #include "mbed.h" |
kenjiArai | 0:f1a10797d9f6 | 20 | #include "nano33blesense_iodef.h" |
kenjiArai | 0:f1a10797d9f6 | 21 | |
kenjiArai | 0:f1a10797d9f6 | 22 | // Definition ----------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 23 | |
kenjiArai | 0:f1a10797d9f6 | 24 | // Constructor ---------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 25 | DigitalOut sen_pwr(PIN_VDD_ENV, 1); |
kenjiArai | 0:f1a10797d9f6 | 26 | DigitalOut i2c_pullup(PIN_I2C_PULLUP, 1); |
kenjiArai | 0:f1a10797d9f6 | 27 | I2C i2c(PIN_SDA1, PIN_SCL1); |
kenjiArai | 0:f1a10797d9f6 | 28 | |
kenjiArai | 0:f1a10797d9f6 | 29 | // RAM ------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 30 | |
kenjiArai | 0:f1a10797d9f6 | 31 | // ROM / Constant data -------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 32 | |
kenjiArai | 0:f1a10797d9f6 | 33 | // Function prototypes -------------------------------------------------------- |
kenjiArai | 1:cce280da16d4 | 34 | |
kenjiArai | 1:cce280da16d4 | 35 | // subroutin (must be at this below line and do NOT change order) ------------- |
kenjiArai | 1:cce280da16d4 | 36 | #include "usb_serial_as_stdio.h" |
kenjiArai | 1:cce280da16d4 | 37 | #include "check_revision.h" |
kenjiArai | 1:cce280da16d4 | 38 | #include "common.h" |
kenjiArai | 0:f1a10797d9f6 | 39 | |
kenjiArai | 0:f1a10797d9f6 | 40 | //------------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 41 | // Control Program |
kenjiArai | 0:f1a10797d9f6 | 42 | //------------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 43 | int main() |
kenjiArai | 0:f1a10797d9f6 | 44 | { |
kenjiArai | 1:cce280da16d4 | 45 | usb_serial_initialize(); |
kenjiArai | 1:cce280da16d4 | 46 | print_revision(); |
kenjiArai | 0:f1a10797d9f6 | 47 | i2c_pullup = 1; |
kenjiArai | 0:f1a10797d9f6 | 48 | sen_pwr = 1; |
kenjiArai | 1:cce280da16d4 | 49 | print_usb("Check I2C line\r\n"); |
kenjiArai | 1:cce280da16d4 | 50 | ThisThread::sleep_for(200ms); |
kenjiArai | 0:f1a10797d9f6 | 51 | check_i2c_connected_devices(); |
kenjiArai | 0:f1a10797d9f6 | 52 | while (true) { |
kenjiArai | 1:cce280da16d4 | 53 | print_usb("\r\n"); |
kenjiArai | 0:f1a10797d9f6 | 54 | check_i2c_sensors(); |
kenjiArai | 1:cce280da16d4 | 55 | ThisThread::sleep_for(2s); |
kenjiArai | 0:f1a10797d9f6 | 56 | } |
kenjiArai | 0:f1a10797d9f6 | 57 | } |
kenjiArai | 0:f1a10797d9f6 | 58 | |
kenjiArai | 0:f1a10797d9f6 | 59 | #endif // EXAMPLE_1_CHECK_I2C_DEVICES |