K66 Beta Test

Status
Not open for further replies.
General technical question out of the context, not directly MK66/64 related: can the bus clock divider be modified after booting, for example in the setup() part of a sketch?
 
yes, easy.
just write the new value.

for example, for 96MHz F_CPU, same F_BUS:
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) | SIM_CLKDIV1_OUTDIV4(3);

SIM_CLKDIV1_OUTDIV2 is for F_BUS

..but read the manual to get a better understanding!
 
does teensy K66 have 16 mhz crystal? (same make and model as teensy 3?) if so, 16mhz doesn't divide 180 mhz (VCO multiplier of 22 gives 176 mhz), or am I wrong again? (12 mhz crystal would let you reach 180 mhz).

-inquiring minds
 
Yes, 16MHz. And there is no divisor.
But the K66 has an own 48MHz clock for USB - At the moment, i don't know if both can be used simultanously.

If not, there is a way NOT to use the crystal @ 180 MHZ, and instad the 48MHz clock only.
Had this seen on a forum (Freescale?), but I lost the bookmark..

Edit: I meant, there is no divisor for USB. 180MHz F_CPU are possible with the crystal:

MCG_C5 = MCG_C5_PRDIV0(1);
MCG_C6 = MCG_C6_PLLS | MCG_C6_VDIV0(29);
 
Last edited:
Would you suggest working off of Beta2 or off of clone of cores?

Either is fine.

Should we coordinate library testing / porting with a list in this thread or via github-issues?

Please keep all the conversation here. Obviously code fixes go on github.

If someone would like to maintain a list of known problems or outstanding issues, probably list a list of message numbers, that'd really help.

180MHz: Maybe there is a trick and the IRC48 clock canbe used somehow.

Yes, that's one of many little things needed...

just for fun, i tried 240 MHz... works.. (but not with SIM_CLKDIV1_OUTDIV4(8); instead value 7 works (?))

Edit:
...but F_BUS with 240MHz does not work :) Oh, there is indeed a limit.. :)

:)

So far 192 was the fastest I ever tried.
 
Thank you, Frank. Obviously you have more luck with the SIM than me with the PITs... :(

I think that after modifying the bus clock in that way, it's needed to re-define F_BUS, so that libraries like FreqMeasureMulti which rely on that will do the appropriate pulse count to frequency conversion. But I will try to check next weekend first if the FTMs can run on 96 instead of 48 MHz, too. That would allow me to do 14bit PWM at 5859.375Hz with a simpler Sallen-Key filter in my current project.
 
"...but F_BUS with 240MHz does not work" Is that the clock used for the internal timers? I'm interested in what the best available timer resolution is, if it is different from T3.2. For example, I think the PulsePosition library based on this comment can do 21 nsec timing (F_BUS = 48 MHz with T3.1/3.2 CPU at either 48 or 96 MHz). Does the new Beta board improve on this, and if so by how much?
 
Mine arrived today (gorgeus!) and just tested with TFT_ILI9163C library (modified).
Seems works perfectly till 168Mhz, but jumped to 180Mhz code worked but serial stop working, gived this error 'Error while setting serial port parameters: 38,400 N 8 1'.
The Teensyloader shows an even more interesting state, at the bottom 'Beanchmark.ino is unreadable'
At 192Mhz, surprise! It works, but it changed the serial port number!

UPDATE:
Going back from 192Mhz to 180Mz the sketch upped correctly but Serial disappeared completely!
Have to press reset, then switch back to 168Mhz and serial resumed.
The benchmark showed that at 168Mhz is much faster, ok, it's the first test and uses only SPI.
Looks like it doesn't like Serial at 180Mhz.
 
Last edited:
Yes, all libs need a change if modifing F_BUS... will take some weeks /month i think..
..i did just a quick test, if it is possible !

@sumotoy: For 180MHz, USB is not supported at the moment.
 
I'm going to start sending out the next round of beta boards next week. If you are on the list (see post #1) and want to get your hands on one to start testing be sure to send me an email and I'll get one out to you.
 
Here's a quick shout-out for Erin, who hand soldered all these beta test boards. :)

attachment.php


This photo is actually from when she soldered the Teensy LC betas.
 
Ok, found the reason for my OUTDIV4-Problem.
Manual: "When OUTDIV1 equals 0000 (divide by 1), the otherdividers cannot be set higher than 0111 (divide by 8)."
Unfortunately, that means more than 240MHz is only possible with disabling the Flashmemory.
 
It arrived :D

Nice looking board. Will be interesting to see how you squish everything down to fit in between those two rows of pins.

Also wish I could borrow Erin to solder a few of my own boards, but that is a different topic ;)

Looks like I need to do some editing of my own libraries to work. My assumption is Teensy 3.5?

Should be easy but may not test the bioloid library using half duplex as to not risk having servo respond at 5v... I will try to breadboard up level shifter.

Again wondering if there is preferred way you prefer ifdefs. Example in my bioloid library I have code like:
Code:
void ax12Init(long baud, Stream* pstream, int direction_pin ){
    // Need to enable the PU resistor on the TX pin
    s_paxStream = pstream; 
    s_direction_pin = direction_pin;    // save away. 

    // Lets do some init here
    if (s_paxStream == &Serial) {
        Serial.begin(baud);
    }  
  
    if (s_paxStream == (Stream*)&Serial1) {
        Serial1.begin(baud);
#if defined(__MK20DX256__) || defined(__MKL26Z64__)
        if (s_direction_pin == -1) {
            UART0_C1 |= UART_C1_LOOPS | UART_C1_RSRC;
            CORE_PIN1_CONFIG = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3) | PORT_PCR_PE | PORT_PCR_PS; // pullup on output pin;
        } else {
            Serial1.transmitterEnable(s_direction_pin);
        }
#elif defined(TEENSYDUINO)
        // Handle on Teensy2...
        if (s_direction_pin != -1) {
            Serial1.transmitterEnable(s_direction_pin);
        }
#endif
    }    
...
My first pass will be to probably add some more to the first #if

Also in this case I am wondering about if it would make sense to try transceiver driver enable (59.5.1.7) if the direction pin is defined on am RTS pin.

Assuming I can breadboard this up and works, should this be done as part of the library or potentially wrapped into Serial1.transmitterEnable code.


Now time to get to work
 
Perhaps a simple
Code:
#ifdef F_BUS
#undefine F_BUS
#define F_BUS 96000000
#endif
After modifying the divider in setup() as in the example above would do the job?

Yes, if there no #if F_BUS == XYZ in the library..

But simply halving the values should do the trick, too. For example instead of Serial1.begin(9600) , Serial1.begin (4800)... same with other devices which are clocked by F_BUS.
But this is off-topic.. :) You can do this with any Teensy 3.x
 
Some stuff like serial baud rates use equations, which should automatically adapt. Other stuff like I2C clock rates uses a big list of #ifdef checks for specific speeds, so that code will need to be updated.
 
Indeed - Thanks to Erin! Great looking work - Sooooo many tiny pins on that huge K66!

Mine arrived today (gorgeus!) and just tested with TFT_ILI9163C library (modified).
UPDATE:
Looks like it doesn't like Serial at 180Mhz.

sumotoy can you drop a zip of your TFT_ILI9163C mods? I just soldered a display board and starting with the ILI9341.
 
You could use #if defined(KINETISK) and get all 4 teensy3*
Sounds good, tried in my own library and fixed it.

Then compile failed on Adafruit_neopixel. Did same fix in there and it now compiles. However I have two versions of this library installed. The Teensyduino installed one, and the Adafruit one, luckily it looks like you synced up recently.

Anyway put in pull request to make it compile on the new board.

EDIT: Adafruit_Neopixel test app strandtest is working
 
Last edited:
Yes, KINETISK or KINETISK_SPI0 (Assuming _SPI# may define added SPI?) would be much cleaner than #if for 4 things. I'll edit my own ILI9163C when I get back if sumotoy doesn't drop his.

ILI9341 working in the demo I ran with stored FFT Data! (from what I did for the ILI9361C).

Also the last TOUCH ColorButtonsMark3 sample I did for XPT2046_Touchscreen and ILI9341_t3 are working fine. (using PJRC Purple Touch board from OSH)

> BOTH of those at 96 and 192 MHz!
 
sumotoy can you drop a zip of your TFT_ILI9163C mods? I just soldered a display board and starting with the ILI9341.
Sure, here's only parts to be replaced

Question:
Should I Pull changes in my library or just wait?
 

Attachments

  • TFT_ILI9163C.zip
    32.5 KB · Views: 435
Last edited:
Sure, here's only parts to be replaced

Thanks, Done - Works! And works FAST! K66 a bit faster at 192MHz than T_3.2 was at 120MHz with the SPI clock doubled on the SomeBars demo with FFT data doing two VU graphs on screen.

Text only - but - CAUTION- GRAPHIC numbers ahead:
Sketch uses 154,704 bytes (14%) of program storage space. Maximum is 1,048,576 bytes.
Global variables use 5,316 bytes (2%) of dynamic memory, leaving 256,828 bytes for local variables. Maximum is 262,144 bytes.
 
Status
Not open for further replies.
Back
Top