Avatar for benoit


Member since Apr 2018 • Last active Nov 2018
  • 2 conversations

Most recent activity

  • in Porting to new Devices
    Avatar for benoit


    I have a strange bug when I compile Espruino for the Mikro2 clicker 2 (see here for more information about this board). It is based on the STM32F407VGT6, the same MCU that is on the F4discovery board. Thus I started with the STM32F4DISCOVERY.py file to modify the pin names, and I change the prescalers in the system_stm32f4xx.c file located in targetlibs/stm32f4/lib, because the quartz on the mikro2 board is a 25 MHz quartz (it's a 8MHz quartz on the F4DISCO board).

    Everything compiles well and I'm indeed able to run Espruino on the clicker2 board through the USB port. My problem appears when I try to connect a UART module: the effective baud rate I get is not the one I set, it is multipled by a factor 3.125 ?!? So I have to set the baudrate to 18432 to have it at 57600.

     Serial3.setup(18432, { tx:D8, rx:D9 });

    Knowing that 3.125 = 25/8, I guess this issue is related to the fact that there is an "8" MHz lost somewhere in the Espruino files to compile.

    My question is then: is there another file where I have to change the quartz frequency, in addition to the system_stm32f4xx.c file ?

    Thanks for your help :)

  • in General
    Avatar for benoit

    Hi, sorry for the delay to reply.

    I tried and it seems to work, thank you very much ! I will post my code when I will be able to make all the necessary tests to confirm the trick.

    Best regards

  • in General
    Avatar for benoit


    I want to access the TI TRF7960 (a 13.56MHz RFID reader/writer) with Espruino running on a nucleo STM32F401RE. The TI chip can be accessed with SPI, but with an exotic trick : clock polarity has to change between a write and a read instruction. Below is a drawing from the application report "Using the SPI Interface With TRF7960" (http://www.ti.com/lit/an/sloa140a/sloa14­0a.pdf).

    How could I do that ? I tried the following but it doesn't work.

    var spi = new SPI();
    spi.setup({sck:B6, miso:A6, mosi:A7, mode:integer=0, order:'msb'});
    digitalWrite(SS, 0);
    spi.setup({sck:B6, miso:A6, mosi:A7, mode:integer=3, order:'msb'});
    d = spi.write(0b01000100);
    digitalWrite(SS, 1);

    Thank you :)