osresearch / micropython

MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
https://micropython.org
MIT License
31 stars 8 forks source link

USART For the small On/Off remote looks inverted #10

Open Jerome-PS opened 4 years ago

Jerome-PS commented 4 years ago

Hi,

Thanks for the good work! It looks like, contrary to what is written in efm32/ports/efm32/README.md, the USART is configured for pins PB14 and PB15. But if you follow the marking on the board, PB14 seems to be US0_TX and PB15 US0_RX (so locations 9 and 9 and NOT 8 and 10). Does it make sense to put the in a init.py script to have the same binary for everyone and just a "site" auto exec script that would do the configuration?

Cheers.

osresearch commented 4 years ago

I'm just getting back to this project and will check out the pin outs. It's highly likely that I swapped them at some point when I was trying to unify the USART setup code between the different boards.

Jerome-PS commented 4 years ago

Hi,

Also, there is a mistake in pin_defs.h, available pins are PC10 and PC11 NOT PC11 and PC12 !!!

Here is the information I have collected for the small 2-button remote: (For the U/D, I did not check which corresponds to the 1 or 0 embossing on the enclosure)

{ {&machine_pin_type}, gpioPortA, 0,  0, PWM(0,0) }, // pcb label PWM4  - PA0   Join BTN
{ {&machine_pin_type}, gpioPortA, 1,  1, PWM(1,0) }, // pcb label PWM3  - PA1   
{ {&machine_pin_type}, gpioPortB, 12, 2, PWM(2,5) }, // pcb label PWM2  - PB12  U/D BTN
{ {&machine_pin_type}, gpioPortB, 13, 3, PWM(3,5) }, // pcb label PWM1  - PB13  

// right side going up
{ {&machine_pin_type}, gpioPortB, 15, 4, NO_PWM }, // RX            - PB15  RX
{ {&machine_pin_type}, gpioPortB, 14, 5, NO_PWM }, // TX            - PB14  TX
{ {&machine_pin_type}, gpioPortC, 10, 6, NO_PWM }, //           - PC10  U/D BTN
{ {&machine_pin_type}, gpioPortC, 11, 7, NO_PWM }, //           - PC11  LED
{ {&machine_pin_type}, gpioPortF, 0,  8, NO_PWM }, // SWCLK     //TODO: see if user can kill his debug connection
{ {&machine_pin_type}, gpioPortF, 1,  9, NO_PWM }, // SWD           //TODO: see if user can kill his debug connection
{ {&machine_pin_type}, gpioPortF, 2,  10, NO_PWM }, // ?            - F2
{ {&machine_pin_type}, gpioPortF, 3,  11, NO_PWM }, // ?            - F3    SPI FLASH VCC and HOLD

// internal connections
{ {&machine_pin_type}, gpioPortB, 11,  12, NO_PWM }, // spi cs
{ {&machine_pin_type}, gpioPortD, 13,  13, NO_PWM }, // spi sck
{ {&machine_pin_type}, gpioPortD, 14,  14, NO_PWM }, // spi miso
{ {&machine_pin_type}, gpioPortD, 15,  15, NO_PWM }, // spi mosi
Jerome-PS commented 4 years ago

PF3 must be driven high, or the FLASH chip does not operate.

Jerome-PS commented 4 years ago

In mpconfigport.h, if you do the following, device registers become accessible from Python, by using machine.mem32[addr], this is very useful, even though it uses more code space, it still perfectly fits into the device's 256kB:

define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)