• AVR Freaks

Hot!UART interrupt not working in Debug mode along with masked SPI [Solved]

Author
Gautham1996
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2019/09/27 23:47:22
  • Location: 0
  • Status: offline
2020/12/19 05:14:15 (permalink)
0

UART interrupt not working in Debug mode along with masked SPI [Solved]

Hello there.
 
I am trying to implement an acquisition system, with three SPI communications from 3 multi channel ADCs and I am trying to acquire data and store into my PC using interrupt based UART. However, on implementing the code attached in PIC24EP512GU814, I am finding trouble while working in Debug mode. On sending a UART command (eg. 0x00) in Debug mode without placing any breakpoints in MPLAB XIDE, the software shows a "Target haulted due to a software breakpoint" error. On further analyzing the code in Program memory, I found out that after a "RETFIE" command, the next instruction is a set of "BREAK" and "RESET" command. I am not using any Watch dog timer. Although I am using BOR, even when the configuration bit is disabled, the same error happens. Am I missing any specific set of instructions in the code?
post edited by Gautham1996 - 2020/12/22 23:38:40
#1
RISC
Super Member
  • Total Posts : 5998
  • Reward points : 0
  • Status: online
Re: UART interrupt not working in Debug mode along with masked SPI 2020/12/19 08:18:02 (permalink)
4 (2)
Hi,
Why are you inserting assembly lines in your C source code....:=(((
It is very dangerous to do this unless you know extremely well the compiler...
Don't be surprised if execution stops..probably means the processor went out of control....
Regards
PS : use the delay libray from the compiler...

For support make sure to check first here : http://microchipdeveloper.com
There are hundreds of PIC, AVR, SAM...which one do YOU use ?
#2
Gautham1996
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2019/09/27 23:47:22
  • Location: 0
  • Status: offline
Re: UART interrupt not working in Debug mode along with masked SPI 2020/12/19 18:58:51 (permalink)
0
My interrupt service routine is entirely written in asm, so that won't matter, does it? 
 
P.S. I am a novice in PIC microcontroller coding, so does each compiler has its own dedicated delay statements?
post edited by Gautham1996 - 2020/12/19 19:02:04
#3
ric
Super Member
  • Total Posts : 29951
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: UART interrupt not working in Debug mode along with masked SPI 2020/12/19 22:08:58 (permalink)
0
Gautham1996
P.S. I am a novice in PIC microcontroller coding, so does each compiler has its own dedicated delay statements?

XC8 and C16 come with built in macros to implement delays simply.
They are useful, as if you don't know what you are doing, it is easy to write a "do nothing" delay that will be entirely thrown away by the first pass of an optimising compiler.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
dmgualb
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2008/01/17 15:53:29
  • Location: 0
  • Status: offline
Re: UART interrupt not working in Debug mode along with masked SPI 2020/12/20 11:46:17 (permalink)
4 (1)
You MAY mix assembly code and C code, but you have to be carefull. You are using too much inline assembly, and you are not doing it correcly. Read carefully the topics about mixing assembly and C in the C compiler user's guide. My last piece of advice: Only use assembly code to do very specific tasks and only when strictly necessary! 
#5
Gautham1996
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2019/09/27 23:47:22
  • Location: 0
  • Status: offline
Re: UART interrupt not working in Debug mode along with masked SPI 2020/12/22 23:38:05 (permalink)
0
I have converted the entire code in ISR from assembly to c code, and now it is working. However, I need to meet some timing requirements, and that is not being matched by the code. I will see to it. Thank you everyone for the help!
#6
Jump to:
© 2021 APG vNext Commercial Version 4.5