aanon4 / bluebasic Goto Github PK
View Code? Open in Web Editor NEWBASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
Home Page: https://gitlab.com/timwilkinson/BlueBasic
BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
Home Page: https://gitlab.com/timwilkinson/BlueBasic
Hi Tim,
tested the HM-10 flashing with cc debugger - seemed to work. now i thought of using the
https://github.com/aanon4/BlueBasic/blob/master/Console/Blue%20Basic.zip
you mentioned / not found / ok / try to build it / oh swift / xcode 4.x on my macbook pro ...
puh - that would be heavy install stuff (os upgrade/xcode upgrade ...)
do you have a working binary for osx lion (10.7.5) somewhere around ?
Best
Paul
BlueBasic under OSX Sierra fails:
xcode 8.1 doesn't support Swift 1.2 anymore. In an attempt to fix the above issue, I imported the project to Xcode 8.1 and converted it to Swift 3. Then I fixed the upload issue by reducing the upload data chunks from 64 down to 20 bytes.
See fork here:
kscheff@6de2ee0
Large numbers result in wrong values, e.g.
PRINT 1<<29
536870912
OK
PRINT 1<<29+1
761419044
OK
In some circumstances this crashes the system. One example is the millis() function:
CONFIG MILLIS, 1<<31
OK
PRINT MILLIS()
... system not responding anymore
This means when using millis() the time counter gets corrupted during day 373 (after 536870912 ms). This might be an issue for IoT applications running extend periods of time and using millis() for time reference.
I'm trying to use BlueBasic on an existing device with I2C peripherals. Looks like they used the hardware I2C on pins 14/15. Possible to access these as general I/O pins ?
Hi.
Thanks for really awesome project!
By the way, I want to customize BlueBasic with myself.
So, I downloaded Project files and open it with IAR.
I opened the project file in BlueBasic/Build.
And compiled it for 'CC2540'.
But, the hex what I created doesn't work at all.
When I flashed the hex what you provided , it works like charm.
But, the hex I compiled doesn't work.
Are there any specific options or process for compiling CC2540 version hex?
(What I want to do is adding PWM function in BlueBasic.
Because I coudn't find how to make PWM pulse currently. )
Thank you.
hi tim, now i had the chance to test with an ipad (ios 8)
The HM-10 (in fact this seems to be a copycat - according to the HM-10 pdf) shows up as BASIC@DC, but no connection can be made - Connecting ... and nothing more ...
I used the BLE Packet Sniffer from TI (with the USB Dongle) to get a better idea whats happening.
Unfortunately i do not have an IAR EW (puh - the price is tough stuff) to try to debug the code itself...
But may be you can read somethin out of the BLE Sniffer Log...
up to [4] is the scan - the rest is the quick connection - disconnection ...
[1] : <Tx> - 10:25:57.023
-Type : 0x01 (Command)
-Opcode : 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length : 0x03 (3) byte(s)
Mode : 0x03 (All)
ActiveScan : 0x01 (Enable)
WhiteList : 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00
------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 10:25:57.038
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (Success)
OpCode : 0xFE04 (GAP_DeviceDiscoveryRequest)
DataLength : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 04 FE 00
------------------------------------------------------------------------------------------------------------------------
[3] : <Rx> - 10:25:57.647
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x2C (44) bytes(s)
Event : 0x060D (GAP_DeviceInformation)
Status : 0x00 (Success)
EventType : 0x00 (Connectable Undirect Advertisement)
AddrType : 0x00 (Public)
Addr : 7C:66:9D:9A:72:DC
Rssi : 0xC5 (197)
DataLength : 0x1F (31)
Data : 02:01:05:11:06:3A:A7:BD:64:0A:F7:A3:B5:8D:44:16:
16:91:9E:FB:25:09:09:42:41:53:49:43:23:44:43
Dump(Rx):
04 FF 2C 0D 06 00 00 00 DC 72 9A 9D 66 7C C5 1F
02 01 05 11 06 3A A7 BD 64 0A F7 A3 B5 8D 44 16
16 91 9E FB 25 09 09 42 41 53 49 43 23 44 43
------------------------------------------------------------------------------------------------------------------------
[4] : <Rx> - 10:26:07.303
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x0C (12) bytes(s)
Event : 0x0601 (GAP_DeviceDiscoveryDone)
Status : 0x00 (Success)
NumDevs : 0x01 (1)
Device #0
EventType : 0x00 (Connectable Undirect Advertisement)
AddrType : 0x00 (Public)
Addr : 7C:66:9D:9A:72:DC
Dump(Rx):
04 FF 0C 01 06 00 01 00 00 DC 72 9A 9D 66 7C
------------------------------------------------------------------------------------------------------------------------
[5] : <Tx> - 10:26:12.575
-Type : 0x01 (Command)
-Opcode : 0xFE09 (GAP_EstablishLinkRequest)
-Data Length : 0x09 (9) byte(s)
HighDutyCycle : 0x00 (Disable)
WhiteList : 0x00 (Disable)
AddrTypePeer : 0x00 (Public)
PeerAddr : DC:72:9A:9D:66:7C
Dump(Tx):
01 09 FE 09 00 00 00 DC 72 9A 9D 66 7C
------------------------------------------------------------------------------------------------------------------------
[6] : <Rx> - 10:26:12.607
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (Success)
OpCode : 0xFE09 (GAP_EstablishLinkRequest)
DataLength : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 09 FE 00
------------------------------------------------------------------------------------------------------------------------
[7] : <Info> - 10:26:13.387
Device Connected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 7C:66:9D:9A:72:DC
------------------------------------------------------------------------------------------------------------------------
[8] : <Rx> - 10:26:13.387
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x13 (19) bytes(s)
Event : 0x0605 (GAP_EstablishLink)
Status : 0x00 (Success)
DevAddrType : 0x00 (Public)
DevAddr : 7C:66:9D:9A:72:DC
ConnHandle : 0x0000 (0)
ConnInterval : 0x0050 (80)
ConnLatency : 0x0000 (0)
ConnTimeout : 0x07D0 (2000)
ClockAccuracy : 0x00 (0)
Dump(Rx):
04 FF 13 05 06 00 00 DC 72 9A 9D 66 7C 00 00 50
00 00 00 D0 07 00
------------------------------------------------------------------------------------------------------------------------
[9] : <Info> - 10:26:13.932
Device Disconnected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 7C:66:9D:9A:72:DC
------------------------------------------------------------------------------------------------------------------------
[10] : <Rx> - 10:26:13.932
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0606 (GAP_TerminateLink)
Status : 0x00 (Success)
ConnHandle : 0x0000 (0)
Reason : 0x3E (Failed To Establish)
Dump(Rx):
04 FF 06 06 06 00 00 00 3E
------------------------------------------------------------------------------------------------------------------------
Is is possible to run basic code after reboot?
BlueBasic support upload basic file, so if BlueBasic can load and run basic file after started
(say init.bbasic), it should work.
What does UPGRADE AVAILBLE means in console status at bottom ?
the place where you have CONNECTED , CONNECTING..
and one last question, how to broadcast the battery level in iBeakon mode ?
Thanks for creating BlueBasic.
How to use ADC? I looked every page in the Wiki and could not find it.
Thanks again!
When I try to use P2_1 and later for output, get the message "Bad pin". Transcript of session below.
Thanks for creating this, I'm very excited!
BlueBasic CC2541/20150213105740/OAD v0.6
http://blog.xojs.org/bluebasic
7856 bytes free.
OK
PINMODE P2(0) OUTPUT
OK
P2(0) = 1
OK
PINMODE P2(1) OUTPUT
Bad pin
P2(1) = 1
Bad pin
Hello,
I am trying to set the Major and Minor values using the iBeacon example but am running into an issue.
The values in the example are (work just fine):
M(0) = 0
M(1) = 1
I am trying to set:
M(0) = 0x11
M(1) = 0x59D8
I am able to program the chip and it comes back with "OK" but the values are not set along... I am using hex values should i be doing something different?
When writing files and program code the memory becomes eventually low. BlueBasic then tries to free up some memory by compacting the flash store. However this function is seriously broken and it messes up the flash store. Typically this destroys parts of the stored program. In some cases this locks the entire device, so you can only recover by CC-Debugger.
This bug gets triggered when the flash store_compact() routine gets called.
I have fixed the bug here kscheff@d202a8f
Hello,
I started developing BlueBasic console for Linux. It still looks like dirty hack ( unfortunately I'm not C hacker), but at least works for me.
Here is the code: https://github.com/0xFACE/bbconsole
This is not the issue, but rather an invitation for users who like BlueBasic project ;-)
Thanks.
Have you seen any issues with the beacon running the iBeacon example then dyeing after about 48 hours?
I have 8+ beacons that all died at about the same time (within two hours of each other). The fix was to take the battery out and then place it back in.
Note: All beacons had been programmed within two hours of each other.
Hi excellent project, have been trying to load BlueBasic to a module for a couple of hours today.
this is the method I'm using https://github.com/RedBearLab/CCLoader
uses an arduino to act as a programmer.
The module I am trying to update is a ble-cc41-a, which has a cc2541 on it.
I was trying using the bin file for the cc2541 chip from you repo.
it appears to flash ok, but cannot see any devices in the console.
Is the .bin from this repo comptable do you think?
Is there are way to check that code is running, debug output from module on serial ?
thanks in advance
May be a stupid question but I would love to install and use this!
I have cloned the project but am not sure how to install or what to install...
BlueBasic is using 32-bit variables. When I create characteristic for reading, the response value is 32bit long. Is it possible to respond with uint8 values ?
According to the specification: alert level characteristic is uint8:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.alert_level.xml&u=org.bluetooth.characteristic.alert_level.xml
32bit response gives invalid value :
On this wiki page, the last line of the table says P1(4) instead of P2(4)
https://github.com/aanon4/BlueBasic/wiki/Pin-names-and-uses
I can't find how to edit this wiki :-(
Hello,
Now, with latest firmware it is possible to upgrade firmware for cheap HM-10/HM-11 module via UART, using serial bootloader protocol (http://processors.wiki.ti.com/index.php/SerialBootLoader)
Can I upload BlueBasic firmware this way into HM-10/11 module?
When connecting to the Beacon now I get a "Upgradable" in the bottom console window where it would normally say "Connected".
Steps:
I am able to connect to another beacon i built and flashed with the hex file (was flashed a few weeks ago).
Is this "console" app. mean to load basic programs on the chip? Is there a Windows version?
Hello again! I have been using BlueBasic for a few days now and love it so thank you for making it!!
I am looking to set the Advertising interval on the iBeacon example but i am not 100% sure how to change that... Is this something you have built in? Any examples would be much appreciated!
Hello,
I understand that this repro is kind of "dead" since Tim has left the project. However this is the only place to "hope" for exchange of experience... maybe someone is reading here.
Writing an array to a file works, however after the write command the execution stalls.
Here is my program list
10 OPEN 0, READ "A"
15 FOR I = 1 TO 10
20 READ #0, B
30 PRINT I,",",B
40 NEXT I
60 RETURN
100 OPEN 0, TRUNCATE "A"
110 DIM U(10)
120 WRITE #0, U
140 CLOSE 0
150 RETURN
goto 100
Bad expression
>> 140 CLOSE 0
I can read the file successfully by walking to its elements via:
run
1,0
2,0
3,0
4,0
5,0
6,0
7,0
8,0
9,0
10,0
OK
The issue I am fighting is that I wanted to implement an IoT data logger for solar cells mounted on the camping car. Therefore I need a way to store and access some historic values. Doing by writing single vars wastes a lot of memory, e.g. each var occupies 8 bytes (examine the reported memory). So I was looking to write an array instead. It looks like that each array element consumes 1 byte.
I have tried to write different array sizes since I suspected an alignment requirements, but this fails, too. I tried array sizes of 1, 2, 3, 4, 5, 8, 16. Also I checked different file name "A" or "F".
Is there anybody out there that have successfully used these functions?
Thanks
Kai
Based on your wiki page: "https://github.com/aanon4/BlueBasic/wiki/Pin-names-and-uses"
You are showing
P0_2 -> RX
P0_3 -> TX
Based on TI's information i show them as:
P0_2 -> MISO
P0_3 -> MOSI
Am i getting something wrong?
Is it possible to add a simple example on how to read data from a BlueTooth BLE slave?
I was trying to use BlueBasic to read data from SensorTag, but only able to discover the device, not able to figure out how to read data from SensorTag.
Thanks a lot!
Hello, I successfully flashed BLE HM-10 module with BlueBasic-CC2541.hex file.
But now I don't how to connect.
I tried to scan for the BLE devices, but HM-10 module is not advertising any more.
Is it ok ? Can I use RX/TX pins to connect console?
Unfortunately I don't have IOS/ OSX device to use the BlueBasicConsole from your repo.
I have read parts of the documentation.
One question I did not find answer to is, if I write a small basic program, can it be saved to flash and autostarted after a power off?
Thank you very much for BlueBasic!
How to use SCAN ? I only see use SCAN to set SCAN response in iBeacon example.
How about SCAN GENERAL|LIMITED ? SCAN "" ?
Can I use SCAN to list other BLE devices nearby ?
I cannot find any information if it is possible to create a device with a permanent program that will run after power up.
How is that to be done?
Love BlueBasic! Thanks!!!!
Right now, BlueBasic only support hardware handshaking
SERIAL 9600,N,8,1,H
This will give error:
SERIAL 9600,N,8,1,N
Here are the codes in OS_serial_open function (os.c ) :
// Only support port 0, no-parity, 8-bits, 1 stop bit
if (port != 0 || parity != 'N' || bits != 8 || stop != 1 || flow != 'H')
{
return 3;
}
Hi all,
I'm trying to set up a low power consumption beacon with the following code:
1 T= 3200
2 CONFIG POWER, 1
3 BTPOKE LIM_DISC_ADV_INT_MIN, T
4 BTPOKE LIM_DISC_ADV_INT_MAX, T
5 BTPOKE GEN_DISC_ADV_INT_MIN, T
6 BTPOKE GEN_DISC_ADV_INT_MAX, T
7 PINMODE P0(4) INPUT PULLDOWN
10 // "A Simple iBeacon service"
20 DIM M(5)
30 // "Major (0-65535), Minor (0-65535), Power"
40 M = 0x00, 0x02, 0x00, 0x04, 0xC8
90 ADVERT GENERAL
100 ADVERT CUSTOM "FF 4C 00 02 15" "74 27 8B DA B6 44 45 20 8F 0C 72 0E AF 05 99 35" M
110 ADVERT END
120 // SET A NAME IN THE SCAN RESPONSE
130 SCAN NAME "iBeacon"
140 SCAN END
150 AUTORUN ON
The problem i'm having is that the part of the code that sets the advertisement interval (line 1 to 6) does not work after a reboot or battery swap. The ibeacon advertisement settings are set up properly as does the led, so the script must have run on boot.
The advertisement interval lines do work when connecting and then typing RUN in the console. On another device, I check the advertisements, and they come in every 2 seconds. The strange thing is though, if I disconnect the console, the advertisements stop. The only way to make the device visible again is taking out the battery, and reinsert it. Unfortunately, the advertisement interval is then back to the fast mode it boots up with.
I think the issue all boils down to: how to make the advertisement interval non volatile?
Hi, Can't find the console for ios or osx on the appstore....?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.