Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Simple testing code for teensy 3.2 doesn't work

  1. #1

    Simple testing code for teensy 3.2 doesn't work

    Hi guys,

    I have a question related to teensy 3.2. I wrote a simple C code

    Code:
    #include "MK20D7.h"
    
    
    
    int main(void)
    {
    
    	PTC->PDDR=1<<5;//set direction
    
    	PTC->PSOR=1<<5;
    	int i;
    	while(1){
    
    
    	}
        return 0;
    }
    for setting high the pin 13 on Teensy. After I uploaded the hex with Teensy Loader, nothing happened. I verified the controller's datasheet, I verified the memory map, everything seems OK, but the led is not lighting.

    To be sure that my Teensy board is working, I wrote the next code in Arduino IDE and uploaded and the led was blinking.
    Code:
    int led = 13;
    
    
    void setup() {                
    
      pinMode(led, OUTPUT);     
    }
    
    
    void loop() {
      digitalWrite(led, HIGH);   
      delay(1000);               
      digitalWrite(led, LOW);    
      delay(1000);               
    }
    Maybe I'm missing something. I would appreciate every answer!

    PS: I used Kinetis Design Studio and code is compiled with arm-none-eabi-gcc.

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,250
    Quote Originally Posted by 23ars View Post
    PS: I used Kinetis Design Studio and code is compiled with arm-none-eabi-gcc.
    as the problem is with KDS maybe the overall initialization is not the same (enabling the ports etc). Did you check with the KDS community if this program is complete? the KDS example I have looks somewhat different. did you try the PE?

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,311
    Quote Originally Posted by 23ars View Post
    Maybe I'm missing something.
    Perhaps enabling the clock to PORTC in the SIM clock gate registers?

    I would appreciate every answer!
    Even the "answer" to just use Arduino instead of KDS?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,311
    And perhaps also the mux setting in the port config register for that pin?

  5. #5
    Thanks a lot! I didn't try the PE...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •