Earl31 / btstack

Automatically exported from code.google.com/p/btstack
0 stars 0 forks source link

uart receiving by USE_IRQ_RX cause the stack crash #334

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. start with SPP_Counter.c on MSP430F5438
2. enable USE_IRQ_RX, change nothing else.
3. When the board start to work, SPP msg write to RFCOMM continuously, Do a 
uart writing to the board will cause crash very soon.

Original issue reported on code.google.com by TaurusN...@gmail.com on 27 Apr 2013 at 11:32

GoogleCodeExporter commented 8 years ago
hi. you are referring to the debug uart here, right?
https://code.google.com/p/btstack/source/browse/trunk/MSP-EXP430F5438-CC256x/fir
mware/hal_usb.c

The code is from TI's examples and I didn't use the existing IRQ driven code. 
I've just commented it out with the USE_IRQ_RX define, just in case someone 
would like to fix it later. If you enable it, it will fill the buffer but 
there's not code that would prevent an overrun. So that's your crash. If you 
like, you can handle the case when that buffer is becoming full, e.g. not 
crashing for starters. A function to read from the buffer would have to disable 
interrupt temporarily (as with any other UART driver).

Original comment by matthias.ringwald@gmail.com on 27 Apr 2013 at 5:15

GoogleCodeExporter commented 8 years ago
hi, thanks for your quick reply ^^

Could I got a example about using UART as a datasource?  I wonder the rightest 
way to code this.

about my previous problem, I've figured out how to fix it.  It's caused by the 
code in IRQ:
__bic_SR_register_on_exit(LPM3_bits);

With this, the code will die definitely, no matter the Uart process related to 
BT or not.  Delete this, everything works fine.  I guess the exit LPM3 affect 
the Run-loop of the stack, cause problem.

P.S. I really like the stack, especially the recent released architecture 
manual.  the architecture is cool with simple concept and clear design style :) 
 Thanks a lot for your brilliant work!  but the problem I found is really 
confusing, even though it's a minor one, it wastes a lot of  time to figure 
out.  Maybe more example or comment will be helpful.

Best wishes, 
TN

Original comment by TaurusN...@gmail.com on 6 May 2013 at 6:40

GoogleCodeExporter commented 8 years ago
hi.

could you post on the developer list? it's not really an issue and the 
discussion won't be found by others either.

i haven't worked with the MSP430 for long. The driver for the BTstack UART does 
use interrupts, so you could look at that for a working example. I'd suggest to 
first get only the UART working without BTstack, then add the BTstack run-loop, 
then only add the actual Bluetooth code. 

Original comment by matthias@bluekitchen-gmbh.com on 6 May 2013 at 10:19