Jump to content
43oh

RobertWoodruff

Members
  • Content Count

    37
  • Joined

  • Last visited

About RobertWoodruff

  • Rank
    Advanced Member

Profile Information

  • Location
    US - Florida
  1. Yes, that had occurred to me as well. If this app was awake at all times that would be easier to implement. But this one spends most of its life in LPM3 (it is a battery powered system). I am too lazy to want to complicate the for loop with logic to see if LPM3 should be delayed or not because a human user is awaiting a response. It is just easier to send the response during the RX ISR routine and let the system fall back into LPM3 when the RX ISR terminates. Essentially the for loop is not running most of the time, if that makes sense. Thank you,
  2. The replies make good points, thank you. I am going to look into disabling the RX ISR while the command is being processed within the RX ISR. That fits within the use-cases for this app. hopefully the HC-05 BT module has enough buffering to hold any few characters that may come in while RX ISR is disabled. Another option is to place the commands in a queue to be processed "later" when not in the RX ISR. Without an OS to support queueing, threading and scheduling issues that is just too much trouble, for this project on this little MCU (running out of code space anyway) Thank you for t
  3. This is a recap of a little adventure in the hopes that it helps someone else out there. This application is on an MSP430G2553 MCU. CSS is used as the IDE and the Energia libraries are in play (a good tooling combination, highly recommend J). The app spends most of its time in LPM3. It wakes up periodically to do certain tasks and also wakes up when traffic comes in on the UART RX channel. The ISR for the RX channel detects the arrival of a command and acts on the command during the ISR. Part of servicing a command is sending a response, which is transmitted via the UART TX channel
  4. The "secret" to having the compiler/linker erase/set the flash memory when a program is flashed in has been solved. In CSS right-click on the project and select Properties. Select Debug then MSP43x Options. In there select under Erase Options "Erase main and information memory." Now whenever a new program is flashed to the MCU the SEGMENTB, C, and D are initialized to 0xFF in every byte. Perfect! Hope this helps someone else out there!
  5. Hi Bob, Your app looks doable to me, though not trivial. The hardware connections and interfaces are straight forward to make work for your prototype. Of course, moving the h
  6. Hi Bob, I use CSS with the Energia libraries (CSS now has explicit support for Energia). It is a reasonable choice, you can
  7. I had come across this article as well and it looks to have the answers. In my attempts to use the CCS #pragma statements the compiler warns it does not recognize them. Hopefully it is a setting somewhere that will let them work. Still researching. Thank you for the effort!
  8. My recommendation is to use the Energia Setup()/Loop() construct, And use CCS as the IDE rather than the Energia IDE. CCS is Eclipse and so the its debugger can be used.. Without the debugger progress will be tough. LPM3 is encapsulated in Energia by the sleep() methods so you make sleep() calls rather than LP3 directly. I have the MCU to respond to traffic on the UART RX channel while in LPM3 by processing the requests during the RX ISR wakeup. Thank you,
  9. I have had good success with using Energia libraries via Code Composer Studio for the TI MSP430. And for low power, interrupt driven application needs. Energia is a framework/libraries that help with some of the nitty stuff. And you have the source to Energia which helps with learning. I have made my own version of certain Energia modules, specifically to extend them to help with event driven needs You are right that it is C++. It always amazes me that we can use full object oriented C++ on these little MCUs. But we can. Classes, encapsulation, methods, and so forth. The UARTs work we
  10. I have figured out how to use flash memory to persist values in the MCU, like to survive across a power failure. So that is cool. One last thing is how does one get the CCS C++ compiler/linker to initialize a flash segment? Does anyone have a technique for initializing a segment? For example, I am mapping the persistent values into SEGMENT_C. The C++ compiler/linker does not, at least as mine is setup, initialize the flash segment. It always has the same values from the last time the program wrote values in there, even when the program is rebuilt and reloaded into the MCU. I have b
  11. Hi Roboticus, You are correct, the parameter values to AT+CLASS= are hex numbers. There is a overview in the Bluetooth spec about formatting and interpreting the 32 bit class value (CoD). I am not going to learn all that now but have learned enough to carry forward with this application. Here is a translation between what is sent to the AT command and what is seen on the Android side /* Android Java code segment */ BluetoothClass bluetoothClass = btDevice.getBluetoothClass(); int deviceClass = bluetoothClass.getDeviceClass(); int majorDeviceclass = bluetoothClass.getMajorDeviceCl
  12. Has anyone figured out how to translate the value supplied to the HC-05 Bluetooth module's AT+CLASS= command to the value that is retrieved on the far end from the Bluetooth device connection? I can find explanations of how the individual bits of a standard BT 32 bit class value are to be interpreted. But I cannot figure out how to encode that value in the HC-05's AT+CLASS= command nor how any value set there translates to the value picked up when doing the BT paring on the far end. For example, if pairing with an Android the Java code on the Android to retrieve the class is something
  13. RX can be monitored by watching, with the CSS debugger, what characters are coming in from the UART interrupts being placed in the "ring_buffer" (HardwareSerial.cpp in Energia). They can also be reliably seen by watching, again with the debugger, the traffic to your serialEvent routine. It is a little tricky because the debugger sort of interferes with the ISRs used to capture the RX traffic. /* * From BT device on UART */ void serialEvent(void) { while(Serial.available()) { int cInt = Serial.read(); /* fetch next char from the UART buffer */ command.addChar(cInt); if (command.
  14. Hi, again, tripwire, Let me ask, what is the difference between these two statements 1. String aStr = String("abc"); 2. String *aStr = new String("abc"); Is this this: In stmt 1 when aStr goes out of scope ~String is called and the object is deleted/freed. In stmt 2 when aStr goes out of scope the object remains allocated and no destructor call?
  15. Hi tripwire, Thank for for the explain. Programming on the TI MCU has brought me back to C++ for the first time in quite a long while (mostly use Java and its JRE on larger platforms). It is interesting getting reacquainted with C++ memory management. Thanks!
×
×
  • Create New...