[Ovmsdev] OVMS Poller module/singleton

Simon Ehlen ovms at highteq.de
Sun Jan 26 23:25:08 HKT 2025


Hi Michael,

please find attached the corresponding backtrace.
However, I don't think it has anything to do with the code.
Because on the one hand I only changed the timing for the mcp2515 and on the other hand the firmware in the other ota partition crashes with the same error now.
The firmware in the other ota partition has been running for several days without a single crash, so that makes no sense to me. Unless it's a general problem with the flash.

Cheers,
Simon

Am 26.01.2025 um 16:16 schrieb Michael Balzer via OvmsDev:
> Simon,
>
> you need to decode the backtrace yourself, as you have local code additions we do not have. Use the a2l script (in support).
>
> Regards,
> Michael
>
>
> Am 26.01.25 um 14:52 schrieb Simon Ehlen via OvmsDev:
>> Hi,
>> it is of course possible that it is due to something else. But that was the only code change I flashed.
>> According to the log, it dies at this point:
>>
>> I (2369) v-ffe: Ford Focus Electric vehicle module
>> I (2369) cellular-modem-auto: Power Cycle 2000ms
>> I (2379) mcp2515: can2: SetPowerMode on
>> D (2439) mcp2515: can2: Set register (0x2b val 0x00->0x00)
>> D (2449) mcp2515: can2:  - read register (0x2b : 0x00)
>> D (2449) mcp2515: can2: Set register (0x60 val 0x00->0x64)
>> D (2459) mcp2515: can2:  - read register (0x60 : 0x64)
>> D (2459) mcp2515: can2: Set register (0x0c val 0x00->0x0c)
>> D (2469) mcp2515: can2:  - read register (0x0c : 0x0c)
>> D (2469) mcp2515: can2: Change op mode to 0x60
>> D (2489) mcp2515: can2:  read CANSTAT register (0x0e : 0x60)
>> E (2489) can: can2: intr=1 rxpkt=1 txpkt=0 errflags=0x23401c01 rxerr=0 txerr=0 rxinval=0 rxovr=0 txovr=0 txdelay=0 txfail=0 wdgreset=0 errreset=0
>> Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
>> Core 1 register dump:
>> PC      : 0x4008a830  PS      : 0x00060a30  A0      : 0x801aaa31 A1      : 0x3ffc4ab0
>> A2      : 0x00120000  A3      : 0x3ffc4af0  A4      : 0x00000024 A5      : 0x00120000
>> A6      : 0x000007e4  A7      : 0x000007ec  A8      : 0x00000000 A9      : 0x3ffc4a80
>> A10     : 0x00000000  A11     : 0x40084a7c  A12     : 0x00000003 A13     : 0x00000008
>> A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000010 EXCCAUSE: 0x0000001d
>> EXCVADDR: 0x00120000  LBEG    : 0x4008a82c  LEND    : 0x4008a848 LCOUNT  : 0x00000001
>>
>> ELF file SHA256: 5e6a07d4d02b1a79
>>
>> Backtrace: 0x4008a830:0x3ffc4ab0 0x401aaa2e:0x3ffc4ac0 0x401aab8a:0x3ffc4ae0 0x401aada5:0x3ffc4b40 0x401ab1f7:0x3ffc4b90 0x401ab22e:0x3ffc4c00 0x401a3c07:0x3ffc4c20 0x401a453a:0x3ffc4c50 0x401a4618:0x3ffc4ca0 0x4011a697:0x3ffc4d20 0x4011a256:0x3ffc4d90 0x40119382:0x3ffc4dd0 0x4011979d:0x3ffc4e00 0x40119b8c:0x3ffc4e60 0x40119c11:0x3ffc4ea0
>>
>> It then boots to a command prompt
>> E (1378) housekeeping: Auto init inhibited: too many early crashes (5)
>>
>> Does that tell you anything?
>>
>> Cheers,
>> Simon
>>
>>
>> Am 26.01.2025 um 14:05 schrieb Michael Balzer via OvmsDev:
>>> Simon,
>>>
>>> you need to connect via USB to set the boot partition if you cannot access the module.
>>>
>>> But… there is no way a wrong MCP2515 timing could cause this. I'd look for other potential causes.
>>>
>>> Regards,
>>> Michael
>>>
>>>
>>> Am 26.01.25 um 13:58 schrieb Simon Ehlen via OvmsDev:
>>>> Hi Michael,
>>>>
>>>> I tried your first suggestion, but after this change the OVMS no longer boots at all.
>>>>
>>>> cnf1=0xc3; cnf2=0xaa; cnf3=0x85;
>>>>
>>>> What is the easiest way to select the firmware on the second partition? Is there a way via the SD card or do I have to connect the OVMS with USB?
>>>>
>>>> Cheers,
>>>> Simon
>>>>
>>>> Am 26.01.2025 um 12:51 schrieb Michael Balzer via OvmsDev:
>>>>> Simon,
>>>>>
>>>>> Am 25.01.25 um 21:00 schrieb Simon Ehlen via OvmsDev:
>>>>>> Are adjustments/improvements also necessary at 125KBPS for CAN2/3?
>>>>>
>>>>> I've had a look at SAE J2284-1 for the 125 kbit timing, and it seems for this speed, the esp-idf, the mcp_can lib and our current driver are outside the spec.
>>>>>
>>>>> SAE recommends a sync jump width of 3 for low (nq=8) and 4 for higher resolutions, and single sampling at 62.5% (range 58.3…69.2%).
>>>>>
>>>>> The esp-idf driver would use a SJW of 3 (would better be 4 as nq=20) and single sampling at 80% (very late). The Arduino lib uses SJW=2 (too low) and triple sampling at 75% (late).
>>>>>
>>>>> Our current driver uses a SJW of 1 (much too low) and triple sampling at 56.25% (too early):
>>>>>     case CAN_SPEED_125KBPS:
>>>>>       cnf1=0x03; cnf2=0xf0; cnf3=0x86;
>>>>>       // BRP=3, PRSEG=1, PS1=7, PS2=7, SJW=1, BTLMODE=1, SAM=1, SOF=1, WAKFIL=0 → Sample 3x at 9/16 = 56,25%
>>>>>
>>>>> (Note: the current comment in the source is incorrect, the tq values need each to be read as +1)
>>>>>
>>>>> Possible SAE solutions for the MCP2515:
>>>>>
>>>>> a)
>>>>>     case CAN_SPEED_125KBPS:
>>>>>       // SAE J2284-1:
>>>>>       // BRP=3, PRSEG=3, PS1=6, PS2=6, SJW=4, BTLMODE=1, SAM=0, SOF=1, WAKFIL=0 → Sample point at 10/16 = 62.5%
>>>>>       cnf1=0xc3; cnf2=0xaa; cnf3=0x85;
>>>>> b)
>>>>>     case CAN_SPEED_125KBPS:
>>>>>       // SAE J2284-1:
>>>>>       // BRP=3, PRSEG=3, PS1=7, PS2=5, SJW=4, BTLMODE=1, SAM=0, SOF=1, WAKFIL=0 → Sample point at 11/16 = 68.8%
>>>>>       cnf1=0xc3; cnf2=0xb2; cnf3=0x84;
>>>>>
>>>>> Please try.
>>>>>
>>>>> Btw, if anyone would like to experiment: the Microchip timing calculator needs to be set to 16 MHz (that's our MCP2515 clock), and you need to add 0x80 to the cnf3 byte generated (that's the SOF flag, cannot be set in the UI).
>>>>>
>>>>> Regards,
>>>>> Michael
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> OvmsDev mailing list
>>>>> OvmsDev at lists.openvehicles.com
>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>
>>>
>>> _______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.openvehicles.com
>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.openvehicles.com
>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-------------- next part --------------
$ ./a2l 0x4008a830:0x3ffc4ab0 0x401aaa2e:0x3ffc4ac0 0x401aab8a:0x3ffc4ae0 0x401aada5:0x3ffc4b40 0x401ab1f7:0x3ffc4b90 0x401ab22e:0x3ffc4c00 0x401a3c07:0x3ffc4c20 0x401a453a:0x3
ffc4c50 0x401a4618:0x3ffc4ca0 0x4011a697:0x3ffc4d20 0x4011a256:0x3ffc4d90 0x40119382:0x3ffc4dd0 0x4011979d:0x3ffc4e00 0x40119b8c:0x3ffc4e60 0x40119c11:0x3ffc4ea0
Using elf file: /home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/ovms3.elf
0x4008a830 is at ../../../../.././newlib/libc/machine/xtensa/memcpy.S:177.
0x401aaa2e is in std::vector<OvmsPoller::poll_pid_t, ExtRamAllocator<OvmsPoller::poll_pid_t> >::_M_emplace_back_aux<OvmsPoller::poll_pid_t>(OvmsPoller::poll_pid_t&&) (e:\ovms\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\bits/alloc_traits.h:263).
258           template<typename _Tp, typename... _Args>
259             static
260             _Require<__and_<__not_<__has_construct<_Tp, _Args...>>,
261                                    is_constructible<_Tp, _Args...>>>
262             _S_construct(_Alloc&, _Tp* __p, _Args&&... __args)
263             { ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); }
264
265           template<typename _Tp>
266             struct __destroy_helper
267             {
0x401aab8a is in OvmsVehicleFordFocusElectric::BMSSetupPolling() (e:\ovms\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\bits/stl_vector.h:923).
918                                          __x);
919                 ++this->_M_impl._M_finish;
920               }
921             else
922     #if __cplusplus >= 201103L
923               _M_emplace_back_aux(__x);
924     #else
925               _M_insert_aux(end(), __x);
926     #endif
927           }
0x401aada5 is in OvmsVehicleFordFocusElectric::ConfigChanged(OvmsConfigParam*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle_ford_focuselectric/src/vehicle_ford_focuselectric.cpp:186).
181       int cell_interval_awk = MyConfig.GetParamValueInt("xfe", "cell_interval_awk", 15);
182
183       m_cfg_cell_interval_drv = cell_interval_drv;
184       m_cfg_cell_interval_chg = cell_interval_chg;
185       m_cfg_cell_interval_awk = cell_interval_awk;
186       BMSSetupPolling();
187     }
188     
189     /**
190      * OvmsVehicleFordFocusElectric destructor
0x401ab1f7 is in OvmsVehicleFordFocusElectric::OvmsVehicleFordFocusElectric() (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle_ford_focuselectric/src/vehicle_ford_focuselectric.cpp:160).
155
156       // Callbacks
157       MyCan.RegisterCallback(TAG, std::bind(&OvmsVehicleFordFocusElectric::CanResponder, this, std::placeholders::_1));
158
159       // Load initial config:
160       ConfigChanged(NULL);
161
162       StdMetrics.ms_v_env_regenbrake->SetValue(true);
163
164       // Init polling:
0x401ab22e is in CreateVehicle<OvmsVehicleFordFocusElectric>() (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle/vehicle.h:662).
657         }
658       };
659
660     template<typename Type> OvmsVehicle* CreateVehicle()
661       {
662       return new Type;
663       }
664
665     class OvmsVehicleFactory
666       {
0x401a3c07 is in OvmsVehicleFactory::NewVehicle(char const*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle/vehicle.cpp:228).
223     OvmsVehicle* OvmsVehicleFactory::NewVehicle(const char* VehicleType)
224       {
225       OvmsVehicleFactory::map_vehicle_t::iterator iter = m_vmap.find(VehicleType);
226       if (iter != m_vmap.end())
227         {
228         return iter->second.construct();
229         }
230       return NULL;
231       }
232
0x401a453a is in OvmsVehicleFactory::SetVehicle(char const*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle/vehicle.cpp:276).
271       }
272
273     void OvmsVehicleFactory::SetVehicle(const char* type)
274       {
275       DoClearVehicle(false, true, true);
276       m_currentvehicle = NewVehicle(type);
277       if (m_currentvehicle)
278         {
279         std::string new_type(type);
280         m_currentvehicletype = new_type;
0x401a4618 is in OvmsVehicleFactory::AutoInit() (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle/vehicle.cpp:297).
292
293     void OvmsVehicleFactory::AutoInit()
294       {
295       std::string type = MyConfig.GetParamValue("auto", "vehicle.type");
296       if (!type.empty())
297         SetVehicle(type.c_str());
298       }
299
300     OvmsVehicle* OvmsVehicleFactory::ActiveVehicle()
301       {
0x4011a697 is in Housekeeping::Init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_housekeeping.cpp:246).
241         ESP_LOGI(TAG, "Auto init Pollers (free: %zu bytes)", heap_caps_get_free_size(MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL));
242         MyPollers.AutoInit();
243     #endif
244
245         ESP_LOGI(TAG, "Auto init vehicle (free: %zu bytes)", heap_caps_get_free_size(MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL));
246         MyVehicleFactory.AutoInit();
247     
248     #ifdef CONFIG_OVMS_COMP_OBD2ECU
249         ESP_LOGI(TAG, "Auto init obd2ecu (free: %zu bytes)", heap_caps_get_free_size(MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL));
250         obd2ecuInit.AutoInit();
0x4011a256 is in std::_Function_handler<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*), std::_Bind<std::_Mem_fn<void (Housekeeping::*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*)> (Housekeeping*, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, void*&&) (e:\ovms\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0/functional:600).
595           template<typename... _Args, typename _Req
596                    = _Require<typename _Traits::__lvalue,
597                               _CheckArgs<_Pack<_Args...>>>>
598             result_type
599             operator()(_Class* __object, _Args&&... __args) const
600             { return (__object->*_M_pmf)(std::forward<_Args>(__args)...); }
601
602           // Handle smart pointers, references and pointers to derived
603           template<typename _Tp, typename... _Args, typename _Req
604                    = _Require<_NotSame<_Class, _Tp>, _NotSame<_Class*, _Tp>,
0x40119382 is in std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, void*) const (e:\ovms\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0/functional:2271).
2266        function<_Res(_ArgTypes...)>::
2267        operator()(_ArgTypes... __args) const
2268        {
2269          if (_M_empty())
2270            __throw_bad_function_call();
2271          return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
2272        }
2273
2274    #if __cpp_rtti
2275      template<typename _Res, typename... _ArgTypes>
0x4011979d is in OvmsEvents::HandleQueueSignalEvent(event_queue_t*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:327).
322               {
323               m_current_started = monotonictime;
324               m_current_callback = *itc;
325               if (m_current_callback->m_callback)
326                 {
327                 m_current_callback->m_callback(m_current_event, msg->body.signal.data);
328                 }
329               m_current_callback = NULL;
330               }
331             }
0x40119b8c is in OvmsEvents::EventTask() (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:273).
268             case EVENT_removehandlers:
269               HandleQueueRemoveHandlers(&msg);
270               break;
271             case EVENT_signal:
272               m_current_event = msg.body.signal.event;
273               HandleQueueSignalEvent(&msg);
274               esp_task_wdt_reset(); // Reset WATCHDOG timer for this task
275               m_current_event.clear();
276               break;
277             default:
0x40119c11 is in EventLaunchTask(void*) (E:/OVMS/home/Simon/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/ovms_events.cpp:94).
89
91        {
92        OvmsEvents* me = (OvmsEvents*)pvParameters;
93
94        me->EventTask();
95        }
96
97      void event_trace(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
98        {


More information about the OvmsDev mailing list