Interrupt UART RXINT1 on dsPIC 33EP256MU806

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

kadlcak
Flowcode V4 User
Posts: 9
Joined: Wed Oct 19, 2011 3:15 pm
Has thanked: 1 time
Contact:

Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby kadlcak » Fri Mar 27, 2020 12:06 pm

Hi,
in my program I use Interrupt UART RXINT1 on dsPIC 33EP256MU806 with internal clock (frequency 7.37 MHz). The program works correctly for about 2 minutes. Then the processor restarts ??? Please can someone advise me where the fault is. When I test a program on the same processor on the BL0032 board, there is no problem. Can there be an error in using the internal clock? Thanks a lot. -j-

User avatar
Benj
Matrix Staff
Posts: 14795
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4756 times
Been thanked: 4361 times
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby Benj » Fri Mar 27, 2020 1:02 pm

Hello,

Could be something like the watchdog timer, can you check this is disabled in the device configuration.

Another potential cause of a reset could be something like a divide by 0 occuring in the program.

kadlcak
Flowcode V4 User
Posts: 9
Joined: Wed Oct 19, 2011 3:15 pm
Has thanked: 1 time
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby kadlcak » Fri Mar 27, 2020 4:17 pm

Hallo Benj,
thank you for the quick reply. I turned off the watchdog timer, but it had no effect. Divide by zero I checked, but as I wrote on BL0032 it runs smoothly. ?????

User avatar
LeighM
Matrix Staff
Posts: 2014
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 691 times
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby LeighM » Fri Mar 27, 2020 4:43 pm

What about hardware, anything running over-voltage, hot, inadequate power supply?

kadlcak
Flowcode V4 User
Posts: 9
Joined: Wed Oct 19, 2011 3:15 pm
Has thanked: 1 time
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby kadlcak » Mon Mar 30, 2020 7:14 am

Hello,
I checked the power supply, disconnected all peripherals physically, no change. Similarly, I did so in the program, leaving only the main program and the macro, which is called by the interrupt. Processor resets periodically after 156 cycles in "Main"
I'm sending the program, including the settings, if possible please see what's wrong.
Thanks -j-
Attachments
Sampler_v3_0_30032020_dsPIC_VMM_INT.fcfx
(23.77 KiB) Downloaded 5 times

User avatar
LeighM
Matrix Staff
Posts: 2014
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 691 times
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby LeighM » Mon Mar 30, 2020 9:40 am

Hi,
This is another example of where you would be better using the circular buffer component.
Doing too much in an interrupt will cause problems.
You really need to be just receiving the one character, into a buffer, on the interrupt.
Then process the information back out of the buffer in the main loop.
This also has the benefit of being able to synchronise with the protocol, i.e. waiting for the STX before you then proceed to process the data

kadlcak
Flowcode V4 User
Posts: 9
Joined: Wed Oct 19, 2011 3:15 pm
Has thanked: 1 time
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby kadlcak » Mon Apr 06, 2020 6:43 am

Hi,
thank you for your advice, I'll test it.
-j-

jlangbridge
Posts: 7
Joined: Mon Aug 26, 2019 4:20 pm
Been thanked: 1 time
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby jlangbridge » Thu Jun 04, 2020 5:47 pm

Not exactly the same thing, but I've been having reset problems with the BL0032. I'm working on a project that uses a lot of Bluetooth comms (I've rewritten the driver using interrupts). It's hard to keep the board up and running for long, it just keeps on rebooting. I can't quite remember, but I think that the problem came up when we started looking at the UART. However, when powered using the power supply, and disconnected from USB, it is rock solid.

I've hooked this up to another board, and I've set a pulse on a GPIO when it boots, and the delay is extremely variable. Sometimes 5 minutes, sometimes 20. Currently, running on wall power, I'm at 1 hour 57 minutes (but my systick of one second is probably a bit off). Looks like something to do with the USB µC, but I haven't put a USB sniffer on it.

I've tried this on my Dell dock (which isn't really a reference) as well as directly on my computer (XPS 15) and a colleague has the same problem, using different hardware. USB2 and USB3 (not type C, haven't tried).

User avatar
Benj
Matrix Staff
Posts: 14795
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4756 times
Been thanked: 4361 times
Contact:

Re: Interrupt UART RXINT1 on dsPIC 33EP256MU806

Postby Benj » Fri Jun 05, 2020 10:22 am

Hello,

Could it be the USB cable you are using? If the Eblocks board and Bluetooth comms plus anything else connected is trying to consume more current then the USB cable can provide then the voltage may be dipping causing the microcontroller to brown out and reset.

Please can you try using a high current mobile phone charge cable and see if this makes a difference.

Or does the board reset when connected to the PSU and the USB is connected but fine when just the PSU is connected?