KurtE
Senior Member+
Thanks, missed that one, Should be fully there I think. Will continue to test.Merged, plus a little fix for the open drain option.
Hopefully Serial4 & Serial5 are fully working now?
Thanks, missed that one, Should be fully there I think. Will continue to test.Merged, plus a little fix for the open drain option.
Hopefully Serial4 & Serial5 are fully working now?
I2C scan works with prop-shield, but onehorse prophshield sketch won't compile (i2c_t3 lib ?)
teensy3.2 K66 K66 dragonfly
@120mhz @120 @180 @80
rate (hz) 1195 2580 2664 2223
madgwick(us) 208 7 4 17
I was wondering about that, it was something else I was wanting to take a look at.Nevermind. SPI1 and SPI2 for KINETISK are currently not present inside SPI.cpp
Trying to update SPI library...
#if F_CPU == 240000000
1551 uint32_t n = usec * 80;
1552 #elif F_CPU == 216000000
1553 uint32_t n = usec * 72;
Re: RNG register addresses
@Paul et al, my "bug" (post #179) for RNG register addresses in kinetis.h needs to be revisited. As it turns out (who knew? -- actually Paul may have known from comments in kinetis.h) there are TWO ways to enable the RNGA peripheral, one using SIM_SCGC3 and one using SIM_SCGC6. The first maps to the original RNG addresses in kinetis.h, the 2nd (which I used in example sketch) maps to the 0x40029000 addresses. So if i had used SIM_SCGC3, all would have been well! (I have since tested both mappings).
Paul, I fear the recent fix you applied to kinetis.h based on my assertion has put things askew, because you have commented out the SIM_SCGC6_RNGA. So I would be tempted to return things as they were, and I should update my example to use SIM_SCGC3 and your original register addresses.
I know the feeling!... :lol:**I've hesitated saying this for some time again - but Github and I do not get along!
cd \Users\Kurt\Documents\GitHub\Cores
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
UPDATE
The problem i had with my SDHC sketch was wrong GPIO pin setting for test pin in my driver (pin 12 on mbed not same as pin 12 on teensy K66). So I was able to correctly read a 512-byte sector from microSD card, took 305us (13.4 mbs)
(this is low-level sector-read testing -- no FAT file system. FAT file system would utilize the sector read/write stuff) == proof of concept
From the URL to the mbed K64 testing, a lot of the "IO time" is spent waiting for DLA to become inactive. With analyzer on K66, the 2nd DLA wait time was 252us, and actual sector transfer time was 43us (= 97mbs) for 4-bit SDIO. F_CPU=96mhz
using SanDisk 8GB microSD
some ADC pins misbehaving??
unconnected ADC read: on most ADC pins with analogRead() I get a randomish non-zero number EXCEPT for A11, A13, A14, A21, and A22 which all read as 0. A21 and A22 are the DAC's. And pulling A15-A19 to GND does not result in 0, but stays randomish at 300 to 400 ??? Pulling A0-A9 to GND reads 0.
I've edited message #93, fixing descriptions of pins 3, 3, 7 & 9, and I added a column for native ports.
Any chance you could post this code? I'd love to give it a try here.
Any comments or corroboration on the misbehaving ADC pins?
void setup() {
for (int i=0; i<=39; i++) {
pinMode(i, INPUT_PULLDOWN);
}
}
void loop() {
for (int i=14; i<=23; i++) {
Serial.print(analogRead(i));
Serial.print(" ");
}
Serial.print(" ");
Serial.print(analogRead(A10));
Serial.print(" ");
Serial.print(analogRead(A11));
Serial.print(" ");
for (int i=31; i<=39; i++) {
Serial.print(analogRead(i));
Serial.print(" ");
}
Serial.print(analogRead(A21));
Serial.print(" ");
Serial.print(analogRead(A22));
Serial.println();
delay(75);
}
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) //Teensy 3.4/3.5
if ((_mosi == 11 || _mosi == 7) && (_miso == 12 || _miso == 8) && (_sclk == 13 || _sclk == 14)){
// SPI
} else if (_mosi == 9 && _miso == 1 && _sclk == 32){
// SPI1
} else if (_mosi == 45 && _miso == 44 && _sclk == 46){
// SPI2
}
#elif defined(__MK20DX128__) || defined(__MK20DX256__) //Teensy 3.0/3.1/3.2
if ((_mosi == 11 || _mosi == 7) && (_miso == 12 || _miso == 8) && (_sclk == 13 || _sclk == 14)) {
// SPI
}
#elif defined(__MKL26Z64__) // Teensy LC
if ((_mosi == 11 || _mosi == 7) && (_miso == 12 || _miso == 8) && (_sclk == 13 || _sclk == 14)) {
// SPI
} else if ((_mosi == 0 || _mosi == 21) && (_miso == 1 || _miso == 5) && (_sclk == 20)) {
// SPI1
}
#endif
I'm working on analogRead right now. A0-A9 work. All others are currently broken. I plan to have this fixed later today....
My current test sketch:
/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
RAM (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 256K
}
SECTIONS
{
.text : {
. = 0;
KEEP(*(.vectors))
/* TODO: does linker detect startup overflow onto flashconfig? */
. = 0x400;
KEEP(*(.flashconfig*))
*(.startup*)
*(.text*)
*(.rodata*)
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} > FLASH = 0xFF
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} > FLASH
_etext = .;
.usbdescriptortable (NOLOAD) : {
/* . = ORIGIN(RAM); */
. = ALIGN(512);
*(.usbdescriptortable*)
} > RAM
.dmabuffers (NOLOAD) : {
. = ALIGN(4);
*(.dmabuffers*)
} > RAM
.usbbuffers (NOLOAD) : {
. = ALIGN(4);
*(.usbbuffers*)
} > RAM
.data : AT (_etext) {
. = ALIGN(4);
_sdata = .;
*(.fastrun*)
*(.data*)
. = ALIGN(4);
_edata = .;
} > RAM
.noinit (NOLOAD) : {
*(.noinit*)
} > RAM
.bss : {
. = ALIGN(4);
_sbss = .;
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
__bss_end = .;
__bss_end__ = .;
} > RAM
_estack = ORIGIN(RAM) + LENGTH(RAM);
}
Hi Paul,
here's a pullrequest for 180MHz USB
https://github.com/PaulStoffregen/cores/pull/141
It works for me, but pls try carefuly and look at the timing, esp. the divisors - it's too late here ..
A brief test indicates that all of these work:
delay delayMicroseconds millis micros elapsedMillis elapsedMicros
The touch (TSI) registers for the K66 are very different than the teensy 3 TSI registers. So additional logic will have to be added to hardware/teensy/avr/cores/teensy3/touch.c