What to do with .h files! Board hangs under keyboard abuse
Hi, finally I have purchased a RedBearLab nRF51822 and USB host shield to try this project out (I am the guy of the midi accordion https://github.com/JasonBugeja/AccordionMega_USB_Keyb).
Currently, the instructions to add the RBL nRF51822 to the Arduino IDE is via repo https://redbearlab.github.io/arduino/package_redbearlab_index.json and not done manually.
I have tried to paste the unzipped folder of RBL (from github) manually but it doesn't work since folder structure does not match.
I have added the RBL nRF51822 via repo using Board Manager in Arduino IDE v1.6.13 and managed to compile and program the board, however I did not paste the Projectconfig.h file as per instructions since the folders of the repo seem to remain online without a local presence on my PC.
What should be done with BLEParser.h?
Even without the .h files, I managed to play my Samson Graphite mini32 through BLE using midimittr on my iPod Touch 6th gen. The only problem I found is that when I abuse the keyboard - multikey glissandos etc, the board seems to hang and requires restart. Is this issue manifesting because of the missing .h files? I have tried the same severe keyboard abuse using my Yamaha UD-BT01 and it doesn't show any issues, so the problem is not with the Samson.
I have used Arduino IDE v1.6.13 and USB_Host_Shield_2.0 & USBH_MIDI from their respective urls on github. Should I use older versions of IDE or libraries or something?
Thanks in advance. Blidino has a lot of potential and the way you structure and comment the code is great!
Regards,
Jason
Hey,
just search your local filesystem for the projectfile.h and replace it. The folders of the repo are cloned locally into some Arduino folders.
I suppose you could try to increase the buffer size in the sketch. Hanging Keys could result from the surplus of latency (which the projectfile.h resolves).. eventually overwriting note-off events with new messages in the buffer.
I have found the location of Projectconfig.h - it is no longer in the *C:\Program Files (x86)* folder but in *C:\Users_(username)_\AppData\Local\Arduino15* as per this forum: https://forum.arduino.cc/index.php?topic=393434.0
It has to be noted that if an update notification for the RBL repo pops up and is installed, the Projectconfig.h needs to be pasted again.
Maybe you can add the above in the ReadMe.
What about the file BLEParser.h? Do I have to do something with it?
If the sketch compiled fine, then BLEParser should have been included/used by the project.
Just put in the same folder as the .ino file
Unfortunately it does not compile when injected with the modified Projectconfig.h file - maybe it changes the CRC code or something? Before the file injection it was compiling successfully. kindly refer to error log below:
Arduino: 1.8.0 (Windows 10), Board: "RBL nRF51822(V1.0 16KB)"
In file included from C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7/cores/RBL_nRF51822/ble-nrf51822-master/source/common/common.h:66:0,
from C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7\cores\RBL_nRF51822\ble-nrf51822-master\source\btle\btle_gap.cpp:16:
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7\cores\RBL_nRF51822\ble-nrf51822-master\source\btle\btle_gap.cpp: In function 'error_t btle_gap_init()':
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7/cores/RBL_nRF51822/ble-nrf51822-master/source/projectconfig.h:113:56: error: 'BLE_APPEARANCE_GENERIC_TAG' was not declared in this scope
#define CFG_GAP_APPEARANCE BLE_APPEARANCE_GENERIC_TAG
^
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7/cores/RBL_nRF51822/ble-nrf51822-master/source/common/assertion.h:101:5: note: in definition of macro 'ASSERT_DEFINE_WITH_HANDLER'
setup_statement;\
^
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7/cores/RBL_nRF51822/ble-nrf51822-master/source/common/assertion.h:118:5: note: in expansion of macro 'ASSERT_DEFINE'
ASSERT_DEFINE(error_t status = (error_t)(sts),\
^
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7\cores\RBL_nRF51822\ble-nrf51822-master\source\btle\btle_gap.cpp:46:5: note: in expansion of macro 'ASSERT_STATUS'
ASSERT_STATUS( sd_ble_gap_appearance_set(CFG_GAP_APPEARANCE));
^
C:\Users\csict\AppData\Local\Arduino15\packages\RedBear\hardware\nRF51822\1.0.7\cores\RBL_nRF51822\ble-nrf51822-master\source\btle\btle_gap.cpp:46:46: note: in expansion of macro 'CFG_GAP_APPEARANCE'
ASSERT_STATUS( sd_ble_gap_appearance_set(CFG_GAP_APPEARANCE));
^
exit status 1 Error compiling for board RBL nRF51822(V1.0 16KB).
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
Mhmm. I cant look into this right now, but try using the original projectconfig.h and replace the following lines:
#define CFG_GAP_CONNECTION_MIN_INTERVAL_MS 8 /**< Minimum acceptable connection interval */
#define CFG_GAP_CONNECTION_MAX_INTERVAL_MS 15 /**< Maximum acceptable connection interval */
#define CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS 2000 /**< Connection supervisory timeout */
#define CFG_GAP_CONNECTION_SLAVE_LATENCY 0 /**< Slave Latency in number of connection events. */
It would still modify the checksums I suppose. Thanks for now.
Ok, found the trick... I changed the values you told me in the original file and replaced the difference in characters with spaces to trick the checksum thing! So the Projectconfig.h thing is settled now - just update the ReadMe for other users.
Regarding the Midi overflow thing there is still a problem. When there is a Midi overflow, the board hangs and bluetooth goes offline. Upon resetting the board from the switch, the boards starts transmitting again and it can pair, but connected keyboard does not play. Turning power off and on again and pairing again works.
Modifying Expression control or any other volume in real-time can hang the board as well - example expression pedal on a Hammond clone or Accordion bellows Expression and even pitch-bend wheel on a master keyboard.
Further up you told me to modify buffer. Is it this line? #define MAX_TX_BUFF 64
Here is the working Projectconfig.h to update in the project: Projectconfig.zip