From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2559 invoked by alias); 19 Feb 2013 00:13:07 -0000 Received: (qmail 2531 invoked by uid 22791); 19 Feb 2013 00:13:04 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_05,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from p02c12o147.mxlogic.net (HELO p02c12o147.mxlogic.net) (208.65.145.80) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Feb 2013 00:12:57 +0000 Received: from unknown [12.218.215.72] (EHLO smtpauth1.linear.com) by p02c12o147.mxlogic.net(mxl_mta-7.0.0-0) with ESMTP id 883c2215.0.512347.00-200.1204595.p02c12o147.mxlogic.net (envelope-from ); Mon, 18 Feb 2013 17:12:57 -0700 (MST) X-MXL-Hash: 5122c38965ccf0ff-1cc785e9a69e0a8278e052dedf0553b4b0f0b695 Received: from smtpauth1.linear.com (localhost [127.0.0.1]) by smtpauth1.linear.com (Postfix) with ESMTP id A3BE6740A3 for ; Mon, 18 Feb 2013 16:12:56 -0800 (PST) Received: from [192.168.0.24] (174-24-24-137.clsp.qwest.net [174.24.24.137]) by smtpauth1.linear.com (Postfix) with ESMTPSA id 6C001740A1 for ; Mon, 18 Feb 2013 16:12:56 -0800 (PST) From: Michael Jones Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Problem setting up an ISR for a K60 PORT Message-Id: Date: Tue, 19 Feb 2013 00:13:00 -0000 To: "ecos-devel@ecos.sourceware.org" Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) X-AnalysisOut: [v=2.0 cv=JaELWz2V c=1 sm=1 a=glloKNylpeYNumXQcclYyA==:17 a] X-AnalysisOut: [=IS08XofM_hMA:10 a=D2_GN2MmYMYA:10 a=BLceEmwcHowA:10 a=kj9] X-AnalysisOut: [zAlcOel0A:10 a=MqDINYqSAAAA:8 a=kxAitrcBM8IA:10 a=ho_TqXLp] X-AnalysisOut: [P4saKkXDAnsA:9 a=CjuIK1q_8ugA:10 a=2Go0jDUl9kKL5ApF:21 a=g] X-AnalysisOut: [7wo-6llVSvttKk7:21] X-MAIL-FROM: X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2013-02/txt/msg00001.txt.bz2 I am struggling to setup an ISR/DSR for a PORT on the K60. My goal is to ge= t an ISR/DSR when Pin 19 of PORTA transitions from high to low. This is pin= PTA19 of the device. My non-working code and complete code below. What the code tries to do is setup PORTA PIN19 as input. Then take the PCR = register and set the interrupt to work off a falling edge.=20 Then create the ISR/DSR. When I toggle the pin, nothing happens.=20 FYI the hardware works with MQX, so I know the hardware is ok. I use it the= same way under MQX where I get an ISR from a negative edge. And I have put= a scope on it to make sure there is an edge. So I am quite sure the proble= m is the code. This code was generated by trying to understand the Kinetis code, but thing= s were not clear to me. Some macros use __pin to mean different things. So = this is my best guess. Does anyone know how to do this? PORT SETUP CODE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D cyghwr_hal_kinetis_port_t *port_p; CYGHWR_HAL_KINETIS_GPIO_PIN_DDR_IN(ALERT_PORT, ALERT_PIN); // Get address for PORTA port_p =3D Ports[0]; // 0xA means interrupt on falling edge. // Read modify write PCR port_p->pcr[ALERT_PIN] =3D (port_p->pcr[ALERT_PIN] & 0xFFF0FFFF) | (0xA << 16); // Create an ISR/DSR for PORTA. // Assuming the priority is what the DSR will run at. // No data passed. cyg_interrupt_create( CYGNUM_HAL_INTERRUPT_PORTA, // Vector 3, // Priority (cyg_addrword_t)0, // Data alert_isr, // ISR alert_dsr, // DSR &alert_handle, // Handle &alert_interrupt); // INTR cyg_thread_suspend(cyg_thread_self()); } ALL CODE =3D=3D=3D=3D=3D=3D=3D=3D=3D #ifndef ALERT_H_ #define ALERT_H_ #include #include #include #include #define ALERT_PORT A #define ALERT_PIN 19 extern void start_alert(cyg_addrword_t data); #endif #include "alert.h" cyg_handle_t alert_handle; cyg_interrupt alert_interrupt; cyghwr_hal_kinetis_port_t * const Ports[] =3D { CYGHWR_HAL_KINETIS_PORTA_P, CYGHWR_HAL_KINETIS_PORTB_P, CYGHWR_HAL_KINETIS_PORTC_P, CYGHWR_HAL_KINETIS_PORTD_P, CYGHWR_HAL_KINETIS_PORTE_P }; cyg_uint32 alert_isr( cyg_vector_t vector, cyg_addrword_t data ) { return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR; } void alert_dsr( cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data ) { } void pmbus_alert_callback(void) { } void start_alert(cyg_addrword_t data) { cyghwr_hal_kinetis_port_t *port_p; CYGHWR_HAL_KINETIS_GPIO_PIN_DDR_IN(ALERT_PORT, ALERT_PIN); // Get address for PORTA port_p =3D Ports[0]; // 0xA means interrupt on falling edge. // Read modify write PCR port_p->pcr[ALERT_PIN] =3D (port_p->pcr[ALERT_PIN] & 0xFFF0FFFF) | (0xA << 16); // Create an ISR/DSR for PORTA. // Assuming the priority is what the DSR will run at. // No data passed. cyg_interrupt_create( CYGNUM_HAL_INTERRUPT_PORTA, // Vector 3, // Priority (cyg_addrword_t)0, // Data alert_isr, // ISR alert_dsr, // DSR &alert_handle, // Handle &alert_interrupt); // INTR cyg_thread_suspend(cyg_thread_self()); }