Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BaseDAP SWD USBDAP USBLocalFileSystem mbed DA14580 SWSPI W25X40BV
USB memory + Writer for DA14580 BLE chip + CMSIS-DAP debugger + USB-UART functions in one chip
One button input loads your application into DA14580 or DA14580 included BLE modules
Quote:
Current compatible hardware description can be found at https://github.com/K4zuki/da14580/releases/tag/MurataBLEr04
Revision 7:5b78247c45c2, committed 2016-03-05
- Comitter:
- k4zuki
- Date:
- Sat Mar 05 01:20:16 2016 +0000
- Parent:
- 6:cb6984367a7a
- Child:
- 8:6b8e38e24938
- Commit message:
- place MyStorage instance - cannot format from PC
Changed in this revision
--- a/W25X40BV.lib Fri Mar 04 10:34:25 2016 +0000 +++ b/W25X40BV.lib Sat Mar 05 01:20:16 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/k4zuki/code/W25X40BV/#b422cdc9d751 +https://developer.mbed.org/users/k4zuki/code/W25X40BV/#4f7e8756d1c4
--- a/main.cpp Fri Mar 04 10:34:25 2016 +0000
+++ b/main.cpp Sat Mar 05 01:20:16 2016 +0000
@@ -6,6 +6,7 @@
#include "DA14580.h"
#include "W25X40BV.h"
#include "loader.h"
+#include "mystorage.h"
/**
- UART -
TX = P0_19
@@ -70,7 +71,7 @@
volatile bool isISP = false;
void BL_int();
-W25X40BV memory(P0_15, P0_13, P0_14, P0_16); // mosi, miso, sclk, cs
+//W25X40BV memory(P0_15, P0_13, P0_14, P0_16); // mosi, miso, sclk, cs
uint8_t Headerbuffer[8]={0x70,0x50,0x00,0x00,0x00,0x00,0x00,0x00};
/*
header[0] | 0x70 | 'p'
@@ -106,11 +107,12 @@
};
*/
-MyStorage flash(P0_15, P0_13, P0_14, P0_16);
+MyStorage flash(P0_8, P0_10, P0_9, P0_7);
+USBLocalFileSystem usb_local(&flash, "local"); //PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name
int main()
{
// USBLocalFileSystem* usb_local = new USBLocalFileSystem(P0_8, P0_10, P0_9, P0_7, "local"); //PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name
- USBLocalFileSystem* usb_local = new USBLocalFileSystem(&flash, "local"); //PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name
+// USBLocalFileSystem* usb_local = new USBLocalFileSystem(&flash, "local"); //PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name
running.write(1);
BL.mode(PullUp);
char hex[]="0123456789ABCDEF"; //DEBUG
@@ -152,7 +154,14 @@
*/
bool _hidresult;
-
+ usb_local.lock(false);
+ while(1) {
+ running.write(1);
+ wait_ms(1000);
+ running.write(0);
+ wait_ms(1000);
+ }
+/*
while(1) {
usb_local->lock(true);
usb_local->remount();
@@ -177,6 +186,7 @@
usb_local->putc('.');
}
}
+*/
/*
usb_local->puts("loadersize: ");
read= 0x0f& (loadersize>>12);
@@ -222,10 +232,12 @@
usb_local->puts("F\n\r");
}
*/
+/*
usb_local->lock(false);
connected = 0;
wait_ms(1000);
}
+*/
}
int file_size( FILE *fp )
--- a/mystorage.cpp Fri Mar 04 10:34:25 2016 +0000
+++ b/mystorage.cpp Sat Mar 05 01:20:16 2016 +0000
@@ -5,9 +5,7 @@
// MyStorage(PinName mosi, PinName miso, PinName sclk, PinName cs);
MyStorage::MyStorage(PinName mosi, PinName miso, PinName sclk, PinName cs) :
_flash(mosi, miso, sclk, cs) {
-
- //storage_initialize();
- }
+}
// virtual int storage_read(uint8_t* data, uint32_t block);
int MyStorage::storage_read(uint8_t *buffer, uint32_t block_number) {
@@ -16,7 +14,7 @@
// receive the data
// _read(buffer, 512);
// _flash.readStream(uint32_t addr, uint8_t* buf, uint32_t count);
- _flash.readStream(block_number*256, buffer, 512);
+ _flash.readStream(256 * (block_number * 2), buffer, 512);
return 0;
}
@@ -28,22 +26,22 @@
// _write(buffer, 512);
// writeStream(uint32_t addr, uint8_t* buf, uint32_t count);
// void pageErase(uint8_t page);
- _flash.pageErase(block_number);
- _flash.pageErase(block_number + 1);
- _flash.writeStream(block_number * 256, (uint8_t*)buffer, 256);
- _flash.writeStream(block_number * 256 + 256, (uint8_t*)(buffer + 256), 256);
+ _flash.pageErase(block_number * 2);
+ _flash.pageErase(block_number * 2 + 1);
+ _flash.writeStream(256 * (block_number * 2), (uint8_t*)buffer, 256);
+ _flash.writeStream(256 * (block_number * 2 + 1), (uint8_t*)(buffer + 256), 256);
return 0;
}
// virtual uint32_t storage_sectors();
uint32_t MyStorage::storage_sectors() {
report_sectors_count++;
- return 256; //256*512
+ return (128); //256*512
}
// virtual uint32_t storage_size();
uint32_t MyStorage::storage_size()
{
report_size_count++;
- return 128*1024; //256*512
+ return (128*512); //256*512
}