[DUE] Watchdog keeps resetting after power on for random amount of time

Hi there!

I currently have an issue on my new Due. If I enable the watchdog, the Due keeps resetting on power-on/reset button for a random amount of time (seconds to hours). If I disable the watchdog this doesn't happen. I have tried both your board specific files and the SAM 1.6.11 default ones for the Due. After boot up everything works fine. M281 works, but causes the boot loop all over again. Any ideas why this might be happening and how to fix it?

Truncated log file:
start
Info:Powerÿstart
Info:Watchþstart
(...)
Info:Watchüstart
Info:PowerUp
Free RAM:58616
Autoretract:0
X:0.00 Y:0.00 Z:0.000 E:0.0000
SelectExtruder:0
FlowMultiply:100
wait

Comments

  • Does it also happen without sd card? Watchdor timeout is 4s so it seems something takes longer but your log has no times and is incomplete so hard so say where it stops.
  • I have no SDcard slot, and SDcard is disabled in config.

    Another log snippet with times and detailed info:

    > 12:49:45.825 : start
    > 12:49:45.853 : Info:Power?start
    > 12:49:45.883 : Info:Watch?start
    > 12:49:45.911 : Info:Watch?start
    > 12:49:45.939 : Info:Watch?start
    > 12:49:45.968 : Info:Watch?start
    > 12:49:45.997 : Info:Watch?start
    < 12:49:46.009 : N1 M110*34
    < 12:49:46.009 : N2 M115*36
    < 12:49:46.009 : N3 M105*36
    < 12:49:46.009 : N4 M114*35
    < 12:49:46.014 : N5 M111 S6*98
    < 12:49:46.015 : N6 T0*60
    < 12:49:46.015 : N7 M20*22
    < 12:49:46.021 : N8 M80*19
    < 12:49:46.021 : N9 M105*46
    > 12:49:46.025 : Info:Watch?start
    > 12:49:46.054 : Info:Watch?start
    (...)
    > 12:49:49.044 : Info:Watch?start
    < 12:49:49.070 : N10 M105*22
    > 12:49:49.073 : Info:Watch?start
    > 12:49:49.102 : Info:Watch?start
    (...)
    > 12:50:29.077 : Info:Watch?start
    < 12:50:29.100 : N11 M105*23
    > 12:50:29.106 : Info:Watch?start
    (...)
    > 12:50:31.924 : Info:Watch?start
    < 12:50:31.946 : N12 M105*20
    > 12:50:31.952 : Info:Watch?start
    (...)
    > 12:50:35.004 : Info:Watch?start
    < 12:50:35.009 : N13 M105*21
    > 12:50:35.033 : Info:Watch?start
    (...)
    > 12:50:38.052 : Info:Watch?start
    < 12:50:38.069 : N14 M105*18
    > 12:50:38.081 : Info:Watch?start
    (...)
    > 12:50:41.132 : Info:Watch?start
    < 12:50:41.132 : N15 M105*19
    > 12:50:41.161 : Info:Watch?start
    (...)
    > 12:50:42.439 : Info:Watch?start
    > 12:50:42.443 : Info:Watchdog Reset
    > 12:50:42.443 : Free RAM:58616
    > 12:50:42.443 : Autoretract:0
    > 12:50:42.443 : X:0.00 Y:0.00 Z:0.000 E:0.0000
    > 12:50:42.444 : SelectExtruder:0
    > 12:50:42.444 : FlowMultiply:100
    < 12:50:42.773 : N16 M105*31
    > 12:50:42.777 : Error:expected line 1 got 16
    > 12:50:42.778 : Resend:1
    > 12:50:42.786 : ok
    < 12:50:42.786 : Resend: N1 M110*34
    < 12:50:42.786 : Resend: N2 M115*36
    < 12:50:42.786 : Resend: N3 M105*36
    < 12:50:42.786 : Resend: N4 M114*35
    < 12:50:42.786 : Resend: N5 M111 S6*98
    < 12:50:42.786 : Resend: N6 T0*60
    < 12:50:42.786 : Resend: N7 M20*22
    < 12:50:42.786 : Resend: N8 M80*19
    < 12:50:42.786 : Resend: N9 M105*46
    < 12:50:42.786 : Resend: N10 M105*22
    < 12:50:42.789 : Resend: N11 M105*23
    > 12:50:42.790 : ok
    > 12:50:42.790 : ok 2
    < 12:50:42.791 : Resend: N12 M105*20
    < 12:50:42.791 : Resend: N13 M105*21
    > 12:50:42.800 : FIRMWARE_NAME:Repetier_0.92.9 FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Delta EXTRUDER_COUNT:1 REPETIER_PROTOCOL:3
    > 12:50:42.800 : PrinterMode:FFF
    > 12:50:42.800 : ok 3
    < 12:50:42.802 : Resend: N14 M105*18
    < 12:50:42.802 : Resend: N15 M105*19
    > 12:50:42.822 : T:20.85 /0 B:20.56 /0 B@:0 @:0
    > 12:50:42.822 : ok 4
  • edited February 14
    And another one, an complete log of a lucky shot:

    < 13:04:57.743 : OpenGL version:4.5.14008 Compatibility Profile Context 21.19.137.514
    < 13:04:57.745 : OpenGL extensions:GL_AMDX_debug_output GL_AMD_blend_minmax_factor GL_AMD_conservative_depth GL_AMD_debug_output GL_AMD_depth_clamp_separate GL_AMD_draw_buffers_blend GL_AMD_framebuffer_sample_positions GL_AMD_gcn_shader GL_AMD_gpu_shader_int64 GL_AMD_interleaved_elements GL_AMD_multi_draw_indirect GL_AMD_name_gen_delete GL_AMD_performance_monitor GL_AMD_pinned_memory GL_AMD_query_buffer_object GL_AMD_sample_positions GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_atomic_counter_ops GL_AMD_shader_stencil_export GL_AMD_shader_stencil_value_export GL_AMD_shader_trace GL_AMD_shader_trinary_minmax GL_AMD_sparse_texture GL_AMD_stencil_operation_extended GL_AMD_texture_cube_map_array GL_AMD_texture_texture4 GL_AMD_transform_feedback3_lines_triangles GL_AMD_transform_feedback4 GL_AMD_vertex_shader_layer GL_AMD_vertex_shader_viewport_index GL_ARB_ES2_compatibility GL_ARB_ES3_1_compatibility GL_ARB_ES3_compatibility GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_bindless_texture GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_compute_shader GL_ARB_conditional_render_inverted GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_query_buffer_object GL_ARB_robust_buffer_access_behavior GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_seamless_cubemap_per_texture GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counters GL_ARB_shader_ballot GL_ARB_shader_bit_encoding GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_stencil_export GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_image_samples GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_sparse_buffer GL_ARB_sparse_texture GL_ARB_stencil_texturing GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_barrier GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_snorm GL_ARB_texture_stencil8 GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transform_feedback_instanced GL_ARB_transform_feedback_overflow_query GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_buffer GL_EXT_copy_texture GL_EXT_depth_bounds_test GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_histogram GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_polygon_offset_clamp GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shader_image_load_store GL_EXT_shader_integer_mix GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_bptc GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_storage GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_IBM_texture_mirrored_repeat GL_INTEL_fragment_shader_ordering GL_KHR_context_flush_control GL_KHR_debug GL_KHR_robust_buffer_access_behavior GL_KHR_robustness GL_KTX_buffer_region GL_NV_blend_square GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float GL_NV_explicit_multisample GL_NV_float_buffer GL_NV_half_float GL_NV_primitive_restart GL_NV_texgen_reflection GL_NV_texture_barrier GL_OES_EGL_image GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_WIN_swap_hint WGL_EXT_swap_control
    < 13:04:57.745 : OpenGL renderer:AMD Radeon HD 7800 Series
    < 13:04:57.745 : Using fast VBOs for rendering is possible
    < 13:04:59.648 : Printer reset detected - initalizing
    > 13:04:59.663 : start
    > 13:04:59.663 : Info:Watch?
    > 13:04:59.663 : nfo:Watch?start
    > 13:04:59.663 : Info:Watch?h?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : ???Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : ???Watch?atch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : Info:Watch?start
    > 13:04:59.663 : ???Watch?start
    > 13:04:59.673 : Info:Watch?start
    > 13:04:59.817 : Info:Watch?start
    > 13:04:59.817 : Info:PowerUp
    > 13:04:59.817 : Free RAM:58616
    > 13:04:59.818 : Autoretract:0
    > 13:04:59.821 : X:0.00 Y:0.00 Z:0.000 E:0.0000
    > 13:04:59.848 : SelectExtruder:0
    > 13:04:59.849 : FlowMultiply:100
    > 13:05:00.816 : wait
    > 13:05:01.815 : wait
    < 13:05:02.025 : N1 M110*34
    < 13:05:02.025 : N2 M115*36
    < 13:05:02.025 : N3 M105*36
    < 13:05:02.025 : N4 M114*35
    < 13:05:02.025 : N5 M111 S6*98
    < 13:05:02.027 : N6 T0*60
    < 13:05:02.027 : N7 M20*22
    < 13:05:02.027 : N8 M80*19
    < 13:05:02.027 : N9 M105*46
    > 13:05:02.029 : ok
    > 13:05:02.031 : ok 2
    < 13:05:02.042 : N10 M220 S100*80
    < 13:05:02.042 : N11 M221 S100*80
    < 13:05:02.042 : N12 M111 S6*84
    > 13:05:02.043 : FIRMWARE_NAME:Repetier_0.92.9 FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Delta EXTRUDER_COUNT:1 REPETIER_PROTOCOL:3
    > 13:05:02.043 : PrinterMode:FFF
    < 13:05:02.043 : N13 T0*8
    > 13:05:02.043 : ok 3
    > 13:05:02.075 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:02.075 : ok 4
    > 13:05:02.075 : X:0.00 Y:0.00 Z:0.000 E:0.0000
    > 13:05:02.075 : ok 5
    > 13:05:02.075 : DebugLevel:6
    > 13:05:02.075 : ok 6
    > 13:05:02.075 : SelectExtruder:0
    > 13:05:02.076 : FlowMultiply:100
    > 13:05:02.076 : ok 7
    > 13:05:02.076 : Unknown command:N7 M20
    > 13:05:02.076 : ok 8
    > 13:05:02.076 : ok 9
    > 13:05:02.076 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:02.076 : ok 10
    > 13:05:02.076 : SpeedMultiply:100
    > 13:05:02.076 : ok 11
    > 13:05:02.076 : FlowMultiply:100
    > 13:05:02.076 : ok 12
    > 13:05:02.076 : DebugLevel:6
    > 13:05:02.076 : ok 13
    > 13:05:02.076 : SelectExtruder:0
    > 13:05:02.076 : FlowMultiply:100
    > 13:05:03.048 : wait
    > 13:05:04.048 : wait
    < 13:05:05.051 : N14 M105*18
    > 13:05:05.051 : wait
    > 13:05:05.056 : ok 14
    > 13:05:05.059 : T:20.98 /0 B:20.83 /0 B@:0 @:0
    > 13:05:06.055 : wait
    > 13:05:07.054 : wait
    > 13:05:08.058 : wait
    < 13:05:08.111 : N15 M105*19
    > 13:05:08.116 : ok 15
    > 13:05:08.119 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:09.115 : wait
    > 13:05:10.114 : wait
    > 13:05:11.118 : wait
    < 13:05:11.174 : N16 M105*16
    > 13:05:11.175 : ok 16
    > 13:05:11.180 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:12.179 : wait
    > 13:05:13.178 : wait
    > 13:05:14.178 : wait
    < 13:05:14.238 : N17 M105*17
    > 13:05:14.240 : ok 17
    > 13:05:14.244 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:15.243 : wait
    > 13:05:16.243 : wait
    > 13:05:17.242 : wait
    < 13:05:17.299 : N18 M105*30
    > 13:05:17.304 : ok 18
    > 13:05:17.304 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:18.303 : wait
    > 13:05:19.302 : wait
    > 13:05:20.306 : wait
    < 13:05:20.363 : N19 M105*31
    > 13:05:20.368 : ok 19
    > 13:05:20.368 : T:20.98 /0 B:20.69 /0 B@:0 @:0
    > 13:05:21.367 : wait

  • Ok, that is no typical behaviour. As I said watchdog timeout is set in firmware to 4 seconds. You repeat the initialization several times per second. 

    If you use a newer version you should have M281 for testing watchdog. Please send M281 and see how long it takes until watchdog triggers. Just to be sure firmware sets timeout correctly.

    If that is 4s it must be something outside firmware. Not sure if it is possible that the reset from connection causes several restarts in a row. Something like that.
  • edited February 15
    Okay, I've solved the issue.

    What I think is happening is that because the Watchdog Counter (WDV) starts at maximum (0xFFF or 4095) at power on, the timer can sometimes be above the Delta Value (WDD = 1024) at the first Counter Reload (WDT_CR), which causes a Watchdog Error (WDERR).

    Replacing (WATCHDOG_INTERVAL<<16) with 0x0fff0000 in HAL.h does the job.

    Do you think this is worth a pull request on github?

  • After looking into sam3x8e datasheet I must say your solution is bad. What you do is disabling watchdog since your WDT does not contain the enable bit, so you are essentially disabling watchdog and then the values are not of importance.
    Please try M281 and see if it resets. Other point is 4s vs. 16s timeout. That are 12 extra seconds where many things can happen.

    But your log shows you come at least until watchdog info wants to write. So please try moving in Printer.cpp
    #if FEATURE_WATCHDOG
        HAL::startWatchdog();
    #endif // FEATURE_WATCHDOG
    a few lines more to the top. I would suggest between
        Com::printFLN(Com::tStart);
        HAL::showStartReason();

    so we init it explicitly before it would trigger according to your log. If that helps I can do this permanently.
  • edited February 16
    I think you misunderstand, the watchdog still works fine, so does M281, at exactly 4 seconds too.

    My full line is:
    WDT->WDT_MR = WDT_MR_WDRSTEN | WATCHDOG_INTERVAL | 0x0fff0000;
    instead of:
    WDT->WDT_MR = WDT_MR_WDRSTEN | WATCHDOG_INTERVAL | (WATCHDOG_INTERVAL << 16);

    The value of WatchDog Delta (WDD) doesn't really matter as long as it's high enough, since you don't use that feature anyway. But maybe a short delay between WDT->WDT_MR and WDT->WDT_CR would work too, since this could also have to do with the update time of the watchdog. I will test later, currently running a print :)
  • Ok, no wI understand it better. I have copied your solution for next update. From docs I read watchdog starts counter at 0xfff and we reduce it to 1024 while at the same moment setting WDD also. So why ever that works I take it that it is possible that WDD is set without adjusting WDV in the same command. Strange I never had that problem or others, but since it works for you and me I see no harm in adopting that solution.
Sign In or Register to comment.