Comments (3)
Your unlock does not work correctly. If interrupts were locked before you locked them again, your unlock method will unlock them.
Actually __set_PRIMASK((CAN_MODULE)->primask_od)
will unlock them only if they were previously unlocked.
Process is:
uint32_t primask = __get_PRIMASK(); // Get interrupt status
__disable_irq(); // Force interrupt disabled
// do the job
__set_PRIMASK(primask); //Re-enable interrupts only if these have been enabled before the disable call
Anything else is wrong and can sooner or later lead to issues.
from canopenstm32.
Driver is done like explained above. Issue you are facing lays somewhere else, not in the interrupt management.
/* (un)lock critical section in CO_CANsend() */
// Why disabling the whole Interrupt
#define CO_LOCK_CAN_SEND(CAN_MODULE) \
do { \
(CAN_MODULE)->primask_send = __get_PRIMASK(); \
__disable_irq(); \
} while (0)
#define CO_UNLOCK_CAN_SEND(CAN_MODULE) __set_PRIMASK((CAN_MODULE)->primask_send)
/* (un)lock critical section in CO_errorReport() or CO_errorReset() */
#define CO_LOCK_EMCY(CAN_MODULE) \
do { \
(CAN_MODULE)->primask_emcy = __get_PRIMASK(); \
__disable_irq(); \
} while (0)
#define CO_UNLOCK_EMCY(CAN_MODULE) __set_PRIMASK((CAN_MODULE)->primask_emcy)
/* (un)lock critical section when accessing Object Dictionary */
#define CO_LOCK_OD(CAN_MODULE) \
do { \
(CAN_MODULE)->primask_od = __get_PRIMASK(); \
__disable_irq(); \
} while (0)
#define CO_UNLOCK_OD(CAN_MODULE) __set_PRIMASK((CAN_MODULE)->primask_od)
from canopenstm32.
Okay thanks for the feedback. I don't understand exactly what the two macros do, but I believe you. I could not solve the problem, and so I ran the function canopen_app_interrupt() in a timer interrupt again, despite freertos. Just like it is solved in the example to freertos.
This is a bit unsatisfying, but at least now everything runs as expected.
from canopenstm32.
Related Issues (20)
- CUBEMX for STM32H7 initialise issue HOT 1
- Missing CO_new() in canopen_app_process ? HOT 6
- Remove the dependency on TICK timer
- Timer interrupt needs to be stopped during reset communication procedure
- Overflow flag in STM32L4xx HOT 5
- TPDO not working on STM32F1 HOT 3
- Issue with running on STM32H735-DK HOT 1
- STM32F4DISCOVERY CAN port cannot communicate HOT 3
- More just as request for help than an actual issue. HOT 1
- SDO download fails with message flood HOT 2
- connectivity issue with Nucleo-F103RB HOT 6
- node ID is not added to COB ID in EDS file HOT 4
- error handling requirement HOT 1
- STM32H735 Example Nothing after bootup Message HOT 2
- Configuring the micro as MASTER problem, CO_NMT_sendCommand() not defined. HOT 3
- STM32H735_DK Example Issue With SDO HOT 1
- How can I detect that an slave node is connected to the CAN bus before the HeartBeat message HOT 2
- Trying to communicate with CAN 500kbps HOT 9
- Trying to receive SDO messages in SDO client over CO_SDOclient_receive HOT 2
- Need to use other CAN thats not CANopen
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from canopenstm32.