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@0:f1a10797d9f6, 2020-02-07 (annotated)
- Committer:
- kenjiArai
- Date:
- Fri Feb 07 01:21:16 2020 +0000
- Revision:
- 0:f1a10797d9f6
- Child:
- 1:cce280da16d4
only test purpose not official
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 | 0:f1a10797d9f6 | 3 | * Nano 33 BLE Sense board runs on mbed-OS5 |
kenjiArai | 0:f1a10797d9f6 | 4 | * Check I2C control line |
kenjiArai | 0:f1a10797d9f6 | 5 | * |
kenjiArai | 0:f1a10797d9f6 | 6 | * Copyright (c) 2020 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 | 0:f1a10797d9f6 | 10 | * Revised: Feburary 5th, 2020 |
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 | #include "USBSerial.h" |
kenjiArai | 0:f1a10797d9f6 | 22 | #include "LPS22HB.h" |
kenjiArai | 0:f1a10797d9f6 | 23 | #include "LSM9DS1.h" |
kenjiArai | 0:f1a10797d9f6 | 24 | #include "HTS221.h" |
kenjiArai | 0:f1a10797d9f6 | 25 | #include "glibr.h" |
kenjiArai | 0:f1a10797d9f6 | 26 | |
kenjiArai | 0:f1a10797d9f6 | 27 | // Definition ----------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 28 | |
kenjiArai | 0:f1a10797d9f6 | 29 | // Constructor ---------------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 30 | RawSerial pc(STDIO_UART_TX, STDIO_UART_RX, 115200); |
kenjiArai | 0:f1a10797d9f6 | 31 | DigitalOut sen_pwr(PIN_VDD_ENV, 1); |
kenjiArai | 0:f1a10797d9f6 | 32 | DigitalOut i2c_pullup(PIN_I2C_PULLUP, 1); |
kenjiArai | 0:f1a10797d9f6 | 33 | I2C i2c(PIN_SDA1, PIN_SCL1); |
kenjiArai | 0:f1a10797d9f6 | 34 | |
kenjiArai | 0:f1a10797d9f6 | 35 | // RAM ------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 36 | |
kenjiArai | 0:f1a10797d9f6 | 37 | // ROM / Constant data -------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 38 | |
kenjiArai | 0:f1a10797d9f6 | 39 | // Function prototypes -------------------------------------------------------- |
kenjiArai | 0:f1a10797d9f6 | 40 | extern void check_i2c_connected_devices(void); |
kenjiArai | 0:f1a10797d9f6 | 41 | extern void check_i2c_sensors(void); |
kenjiArai | 0:f1a10797d9f6 | 42 | |
kenjiArai | 0:f1a10797d9f6 | 43 | //------------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 44 | // Control Program |
kenjiArai | 0:f1a10797d9f6 | 45 | //------------------------------------------------------------------------------ |
kenjiArai | 0:f1a10797d9f6 | 46 | int main() |
kenjiArai | 0:f1a10797d9f6 | 47 | { |
kenjiArai | 0:f1a10797d9f6 | 48 | i2c_pullup = 1; |
kenjiArai | 0:f1a10797d9f6 | 49 | sen_pwr = 1; |
kenjiArai | 0:f1a10797d9f6 | 50 | pc.printf("\r\nCheck I2C line\r\n"); |
kenjiArai | 0:f1a10797d9f6 | 51 | thread_sleep_for(200); |
kenjiArai | 0:f1a10797d9f6 | 52 | check_i2c_connected_devices(); |
kenjiArai | 0:f1a10797d9f6 | 53 | while (true) { |
kenjiArai | 0:f1a10797d9f6 | 54 | check_i2c_sensors(); |
kenjiArai | 0:f1a10797d9f6 | 55 | thread_sleep_for(10000); |
kenjiArai | 0:f1a10797d9f6 | 56 | } |
kenjiArai | 0:f1a10797d9f6 | 57 | } |
kenjiArai | 0:f1a10797d9f6 | 58 | |
kenjiArai | 0:f1a10797d9f6 | 59 | #endif // EXAMPLE_1_CHECK_I2C_DEVICES |