Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
クラス内で通信割り込み用にEventQueueを用いた際に、"Error Message: CMSIS-RTOS error: ISR Queue overflow"が表示され、動作を停止しました。 ソースは次の通りです。コンストラクタが呼び出されたと同時にCANバスの監視を行うクラスです。
using CAN attach
#ifndef CAN_PUBLISHER_H_ #define CAN_PUBLISHER_H_ #include <mbed.h> #include "CANCallback.h" #include "CANCallbackTree.h" #ifndef CAN_BUFFER_SIZE #define CAN_BUFFER_SIZE 8 #endif class CANPublisher : public CANCallbackTree { public: CANPublisher(CAN *can_bus, const uint8_t my_id, const uint8_t host_id = 0x00, osPriority priority=osPriorityNormal) : can_bus_(can_bus), my_id_(my_id), host_id_(host_id), thread_(priority, OS_STACK_SIZE, NULL, "CAN_TASK") { can_bus_->frequency(1e5); can_bus->attach(callback(this, &CANPublisher::rx_isr_), CAN::RxIrq); thread_.start(callback(&can_event_, &EventQueue::dispatch_forever)); } ~CANPublisher(){} private: typedef enum{ TX_IRQ = 0, RX_IRQ = 1, }DataType; CANCallbackTree *tree_; EventQueue can_event_; Thread thread_; CANMessage msg_; CAN *can_bus_; uint8_t my_id_; uint8_t host_id_; char buffer_[CAN_BUFFER_SIZE]; void rx_isr_(){ can_event_.call(callback(this, &CANPublisher::isr_task_handler)); //ISRタスクの呼び出し(ここでエラーが出力される) } void isr_task_handler() { int len = 0; if(can_bus_->read(msg_) && msg_.id == my_id_){ switch(msg_.data[1] >> 7){ case RX_IRQ: // Rx_irq msg_.data[1] &= 0x7F; CANCallbackTree::rxrq(msg_.len, msg_.data); break; case TX_IRQ: // Tx_irq len = CAN_BUFFER_SIZE - CANCallbackTree::txrq(CAN_BUFFER_SIZE, msg_.data, buffer_); can_bus_->write(CANMessage(host_id_, buffer_, len, CANData)); break; default : break; }; } } }; #endif