beta SPI lib is hardwired to 12.5 mbs, no code yet for configuring clock rate, BUT you can manually override by setting divider (DIV) in LPSPI4_CCR, seeGood news: simple SPI (8bit) transfer works (have not tried reading).
Pete, here's a PR I did some days ago:@Frank B: The audio library also uses DMAMEM so I tried compiling the PlaySynthMusic example. It fails because it can't find AudioStream.h and, indeed, that file is not in cores/teensy4. It appears that the audio library hasn't been tested (or even installed?) yet, so this DMAMEM issue may have to be solved to get that working too.
Pete
If someone wants to know how to switch the IMXRT off completely, mail me.. tested, works... but I don't write that here, because if you have no long delay before that, there is currently no way to switch it on again, as it will immediately switch off when it runs the program with the command ... so..it's risky. have not tried if the 13-seconds reset works in this case..
Was wondering if this would work as well:
https://www.amazon.com/SunFounder-I...&keywords=ir+receiver+arduino#customerReviews this it uses a VS/1838B ir receiver.
#define CORE_PIN18_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01
#define CORE_PIN19_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00, // 18/A4 AD_B1_01 GPIO1.17 I2C1_SDA
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01, // 19/A5 AD_B1_00 GPIO1.16 I2C1_SCL
Think the comments are wrong. Been using SCL on pin 19 so 01 and 00 should be swapped in the comment.Which shows that 18 and 19 are swapped here or is it just the comments on the wrong lines?
I've ported IRremote. Here's the modified code if anyone wants to try before beta7.
/u1/home/linux/arduino-1.8.8/hardware/teensy/avr/libraries/IRremote/boarddefs.h:51:26: error: 'PORTB' was not declared in this scope
# define BLINKLED_ON() (PORTB |= B00100000)
^
/u1/home/linux/arduino-1.8.8/hardware/teensy/avr/libraries/IRremote/IRremote.cpp:196:10: note: in expansion of macro 'BLINKLED_ON'
else BLINKLED_ON() ; // if no user defined LED pin, turn default LED pin for the hardware on
^
/u1/home/linux/arduino-1.8.8/hardware/teensy/avr/libraries/IRremote/boarddefs.h:52:27: error: 'PORTB' was not declared in this scope
# define BLINKLED_OFF() (PORTB &= B11011111)
^
/u1/home/linux/arduino-1.8.8/hardware/teensy/avr/libraries/IRremote/IRremote.cpp:198:10: note: in expansion of macro 'BLINKLED_OFF'
else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on
^
Using library IRremote at version 2.2.3 in folder: /u1/home/linux/arduino-1.8.8/hardware/teensy/avr/libraries/IRremote
Error compiling for board Teensy 4-Beta1.
On Teensy 4, i get compile errors
@KurtE
Think the comments are wrong. Been using SCL on pin 19 so 01 and 00 should be swapped in the comment.
class TwoWire : public Stream
{
public:
// Hardware description struct
typedef struct {
volatile uint32_t &clock_gate_register;
uint32_t clock_gate_mask;
volatile uint32_t &sda_mux_register;
volatile uint32_t &scl_mux_register;
volatile uint32_t &sda_pad_register;
volatile uint32_t &scl_pad_register;
volatile uint32_t &sda_input_register;
volatile uint32_t &scl_input_register;
uint8_t sda_mux_value;
uint8_t scl_mux_value;
uint8_t sda_input_value;
uint8_t scl_input_value;
IRQ_NUMBER_t irq;
} I2C_Hardware_t;
constexpr TwoWire::I2C_Hardware_t TwoWire::i2c1_hardware = {
CCM_CCGR2, CCM_CCGR2_LPI2C1(CCM_CCGR_ON),
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00, // 18/A4 AD_B1_01 GPIO1.17 I2C1_SDA
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01, // 19/A5 AD_B1_00 GPIO1.16 I2C1_SCL
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00,
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01,
IOMUXC_LPI2C1_SDA_SELECT_INPUT,
IOMUXC_LPI2C1_SCL_SELECT_INPUT,
3 | 0x10,
3 | 0x10,
1,
1,
IRQ_LPI2C1
};
18/A4 AD_B1_01 1.17 2_cts 1_SDA QT3_1 3:1 A1:6,A2:6
19/A5 AD_B1_00 1.16 1_SCL QT3_0 3:0 A1:5,A2:5
constexpr TwoWire::I2C_Hardware_t TwoWire::i2c1_hardware = {
CCM_CCGR2, CCM_CCGR2_LPI2C1(CCM_CCGR_ON),
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01, // 18/A4 AD_B1_01 GPIO1.17 I2C1_SDA
IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00, // 19/A5 AD_B1_00 GPIO1.16 I2C1_SCL
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01,
IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00,
IOMUXC_LPI2C1_SDA_SELECT_INPUT,
IOMUXC_LPI2C1_SCL_SELECT_INPUT,
3 | 0x10,
3 | 0x10,
1,
1,
IRQ_LPI2C1
};
//value = 40 //pwidth = 43.6us, +duty = 19.5%
//value = 128 //pwidth =111.6us, +duty = 50%
//value = 140 //pwidth =122.0us, +duty = 54.7%
//value = 200 //pwidth =174.3us, +duty = 78.1%
//value = 40 //pwidth = 188.4us, +duty = 84.4%
//value = 128 //pwidth =111.6us, +duty = 50%
//value = 140 //pwidth =101.2us, +duty = 45.3%
//value = 200 //pwidth =48.8us, +duty = 21.9%
void setup() {
pinMode(2, OUTPUT);
pinMode(0, OUTPUT);
}
void loop()
{
analogWrite(2, 50);
delay(500);
analogWrite(0, 140);
delay(500);
}
I stumbled over the following issue
based on post https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test?p=194344&viewfull=1#post194344
I tried to generalize further and found that the program only works for DMA channel 0
Any attempt to use another channel (e.g. 1) generates nonsense
In particular, the DADDR used inside the DMA-isr to know where the DMA is actual writing to, is not correct (even outside the destination array!)
[B]PIN 2[/B]
100 = 100hz
150 = 149.9/150.1 hz
5000 = 5.000khz
15000 = 14.97khz
20000 = 20.00khz
50000 = 50.00khz
100000 = 100.00khz
1Mhz = 1.000Mhz
1.5Mhz = 1.5Mhz but seeing spikes on rising and falling edges
3.0Mhz = 2.996/3.007 Mhz, spikes on rising and falling edges
[B]PIN 0[/B]
1000 = 1.000hz
10000 = 10.00khz
100000 = 100.0khz but seeing spikes on rising and falling
1000000 = 1.00mhz spikes nice and steady
3500000 = 3.478mhz spikes, more oscillation in signal on flat top/bottom
ok no problem - how can I tell the compiler to use OCRAM for this array? It was not my intention to use DTCM anyway. I thought DMAMEM is OCRAM.