Search found 102 matches

by chrismas9
Wed Jul 17, 2019 12:20 pm
Forum: Other Boards
Topic: [STM32L471] Port for STM32 without USB connectivity
Replies: 4
Views: 97

Re: [STM32L471] Port for STM32 without USB connectivity

You also need to remove #define MICROPY_HW_ENABLE_USB (1) and define a REPL UART. Use mpconfigboard.h from the NUCLEO_L432KC port as a starting point. I did the L452 port based on the L432. It doesn't have USB enabled (no connector on NUCLEO board) and it compiles error free for L451 by just changin...
by chrismas9
Thu Jun 27, 2019 5:09 am
Forum: MicroPython pyboard
Topic: ADC measure negative voltage??
Replies: 23
Views: 606

Re: ADC measure negative voltage??

On Pyboard Aref is derived from the main 3V3 regulator. If you want really good absolute accuracy connect a reference to another ADC input and scale your reading with the reference reading. Taking a large number or readings and averaging them will help. 4 readings should give about one more bit, 16 ...
by chrismas9
Wed Jun 26, 2019 12:27 am
Forum: MicroPython pyboard
Topic: ADC measure negative voltage??
Replies: 23
Views: 606

Re: ADC measure negative voltage??

I think there is a typo in your formula. With 100k resistors you will need a small cap on the ADC input as switched cap ADCs will draw transient current spikes from the inputs. You don't say what MCU you are using but some STM32 ADC pins are completely intolerant of voltages outside supply and GND s...
by chrismas9
Tue Jun 25, 2019 3:10 pm
Forum: MicroPython pyboard
Topic: ADC measure negative voltage??
Replies: 23
Views: 606

Re: ADC measure negative voltage??

I have used the method suggested by @roberthh. Here's how it works. Say you want to measure down to -12V. Make a 5:1 voltage divider, eg 10k and 40k. Connect 10k between Aref (3V3) and ADC input. Connect 40k from ADC input to negative voltage. When Vin = 0V ADCin = 3.3 - (3.3 + 0)/5 = 2.44V. When Vi...
by chrismas9
Mon Jun 03, 2019 11:12 pm
Forum: General Discussion and Questions
Topic: PyBoard Timer Question
Replies: 7
Views: 393

Re: PyBoard Timer Question

If you can't find a software solution you could add an analog switch to select the input (PWM) or output waveform to the same ADC. Just stream the ADC as fast as you want and switch to output after enough time to capture some input cycles. Knowing the sample rate you can calculate the average phase ...
by chrismas9
Tue May 21, 2019 4:11 am
Forum: Other Boards
Topic: [STM32F412RG] porting micropython flash memory problems
Replies: 5
Views: 192

Re: [STM32F412RG] porting micropython flash memory problems

I recently did the F413 port. Unless you need Ethernet consider using it instead, or try using it as a starting point instead of F411. It needed a few changes to the port source files, not just a custom config. For example the generic F4 startup file does not support some interrupt vectors like SPI ...
by chrismas9
Tue May 21, 2019 3:46 am
Forum: Other Boards
Topic: STM32F401CCU6 SUPPORT
Replies: 3
Views: 202

Re: STM32F401CCU6 SUPPORT

MicroPython runs on the L432 with 256k/64k. Have a look at it's linker script and mpconfigboard.h. You will see quite a few features turned off, eg pyblegacy, to make it fit. You might be able to have a 16k filesystem. There is room for 26k in L432 but I doubt you will get 32k. You will need 16k ram...
by chrismas9
Thu Apr 25, 2019 4:50 am
Forum: Hardware Projects
Topic: How to expand the size of spiflash?
Replies: 9
Views: 461

Re: How to expand the size of spiflash?

The F411 does not have a hardware QSPI controller. You will need to use 1 bit SPI mode with hard or soft SPI. Have a look at STM32L476DISC port for example.
by chrismas9
Sun Apr 21, 2019 4:14 am
Forum: General Discussion and Questions
Topic: Safety of KY-019 relay
Replies: 4
Views: 200

Re: Safety of KY-019 relay

All domestic room heaters have a tilt switch and thermal cutoff that is independent of the thermostat. I suggest an independent cutout that does not rely on software. A suitable thermal cutoff is something like Digi-Key 317-1127-ND. These are available with different trip temperatures. It must be cl...
by chrismas9
Sat Apr 20, 2019 7:03 am
Forum: MicroPython pyboard
Topic: code in internal flash and mounting sd card as usb mass storage
Replies: 8
Views: 409

Re: code in internal flash and mounting sd card as usb mass storage

Have you considered using frozen byte code? The source code won't be on the system at all and will be better protected than hiding it on an non visible drive. To protect code on a non visible drive you would also have to disable REPL to stop people running their own code to read yours.