Avatar for mdd

mdd

Member since Nov 2017 • Last active Nov 2017
  • 1 conversations
  • 3 comments

Most recent activity

    • 5 comments
    • 2,403 views
  • in Porting to new Devices
    Avatar for mdd

    Hi Gordon,

    I do some tests, port B is not working at all, even a simple digitalWrite() function. so I switch to STM32 approach(instead of WIO_LTE GPIO toggling)and use port A PA7(SPI1-MOSI), neopixel module works now : )

    I do not figure out why port B is not working yet. I guess it's due to L432KC do not have PB2, I padded a fake PB2 by (0,PB2,,,,,)between pin 15 and pin 16 to get the compilation passed but maybe it caused a trouble later on...
    -->in l432kc.csv
    15,PB1,I/O,FT_a,,TIM1_CH3N/USART3_RTS_DE­/LPUART1_RTS_DE/QUADSPI_BK1_IO0/LPTIM2_I­N1/EVENTOUT,COMP1_INM/ADC1_IN16
    0,PB2,,,,,
    16,VSS,S,,,,
    -->in l432kc_af.csv
    PB1,-,TIM1_CH3N,-,-,-,-,-,USART3_RTS_DE,­LPUART1_RTS_DE,-,QUADSPI_BK1_IO0,-,-,-,L­PTIM2_IN,EVENTOUT
    PB2,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-
    PB3,JTDO/TRACESWO,TIM2_CH2,-,-,-,SPI1_SC­K,SPI3_SCK,USART1_RTS_DE,-,I2C2_SDA,-,-,­-,SAI1_SCK_B,-,EVENTOUT
    -->

    checked jspininfo.c, PB2 is removed, seems the pin info is correct(against data sheet):
    -->
    const JshPinInfo pinInfo[JSH_PIN_COUNT] = {
    /* PA0 / { JSH_PORTA, JSH_PIN0+0, JSH_ANALOG1|JSH_ANALOG_CH5, { 0, 0, 0 } },
    /
    PA1 / { JSH_PORTA, JSH_PIN0+1, JSH_ANALOG1|JSH_ANALOG_CH6, { JSH_AF14|JSH_TIMER15|JSH_TIMER_CH1|JSH_T­IMER_NEGATED/ 2 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_SCK/ 3 Uses /, 0 } },
    /
    PA2 / { JSH_PORTA, JSH_PIN0+2, JSH_ANALOG1|JSH_ANALOG_CH7, { JSH_AF7|JSH_USART2|JSH_USART_TX/ 1 Uses /, JSH_AF14|JSH_TIMER15|JSH_TIMER_CH1/ 2 Uses /, 0 } },
    /
    PA3 / { JSH_PORTA, JSH_PIN0+3, JSH_ANALOG1|JSH_ANALOG_CH8, { JSH_AF14|JSH_TIMER15|JSH_TIMER_CH2/ 1 Uses /, JSH_AF7|JSH_USART2|JSH_USART_RX/ 2 Uses /, 0 } },
    /
    PA4 / { JSH_PORTA, JSH_PIN0+4, JSH_ANALOG1|JSH_ANALOG_CH9, { JSH_AF1|JSH_DAC|JSH_DAC_CH1/ 1 Uses /, JSH_AF7|JSH_USART2|JSH_USART_CK/ 1 Uses /, 0 } },
    /
    PA5 / { JSH_PORTA, JSH_PIN0+5, JSH_ANALOG1|JSH_ANALOG_CH10, { JSH_AF1|JSH_DAC|JSH_DAC_CH2/ 1 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_SCK/ 3 Uses /, 0 } },
    /
    PA6 / { JSH_PORTA, JSH_PIN0+6, JSH_ANALOG1|JSH_ANALOG_CH11, { JSH_AF14|JSH_TIMER16|JSH_TIMER_CH1/ 2 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_MISO/ 3 Uses /, 0 } },
    /
    PA7 / { JSH_PORTA, JSH_PIN0+7, JSH_ANALOG1|JSH_ANALOG_CH12, { JSH_AF4|JSH_I2C3|JSH_I2C_SCL/ 1 Uses /, JSH_AF1|JSH_TIMER1|JSH_TIMER_CH1|JSH_TIM­ER_NEGATED/ 2 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_MOSI/ 3 Uses / } },
    /
    PA8 / { JSH_PORTA, JSH_PIN0+8, JSH_ANALOG_NONE, { JSH_AF1|JSH_TIMER1|JSH_TIMER_CH1/ 2 Uses /, JSH_AF7|JSH_USART1|JSH_USART_CK/ 2 Uses /, 0 } },
    /
    PA9 / { JSH_PORTA, JSH_PIN0+9, JSH_ANALOG_NONE, { JSH_AF1|JSH_TIMER1|JSH_TIMER_CH2/ 2 Uses /, JSH_AF4|JSH_I2C1|JSH_I2C_SCL/ 2 Uses /, JSH_AF7|JSH_USART1|JSH_USART_TX/ 2 Uses / } },
    /
    PA10 / { JSH_PORTA, JSH_PIN0+10, JSH_ANALOG_NONE, { JSH_AF1|JSH_TIMER1|JSH_TIMER_CH3/ 2 Uses /, JSH_AF4|JSH_I2C1|JSH_I2C_SDA/ 2 Uses /, JSH_AF7|JSH_USART1|JSH_USART_RX/ 2 Uses / } },
    /
    PA11 / { JSH_PORTA, JSH_PIN0+11, JSH_ANALOG_NONE, { JSH_AF1|JSH_TIMER1|JSH_TIMER_CH4/ 1 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_MISO/ 3 Uses /, 0 } },
    /
    PA12 / { JSH_PORTA, JSH_PIN0+12, JSH_ANALOG_NONE, { JSH_AF5|JSH_SPI1|JSH_SPI_MOSI/ 3 Uses /, 0, 0 } },
    /
    PA13 / { JSH_PORTA, JSH_PIN0+13, JSH_ANALOG_NONE, { 0, 0, 0 } },
    /
    PA14 / { JSH_PORTA, JSH_PIN0+14, JSH_ANALOG_NONE, { 0, 0, 0 } },
    /
    PA15 / { JSH_PORTA, JSH_PIN0+15, JSH_ANALOG_NONE, { JSH_AF3|JSH_USART2|JSH_USART_RX/ 2 Uses /, 0, 0 } },
    /
    PB0 / { JSH_PORTB, JSH_PIN0+0, JSH_ANALOG1|JSH_ANALOG_CH15, { JSH_AF7|JSH_USART3|JSH_USART_CK/ 1 Uses /, JSH_AF1|JSH_TIMER1|JSH_TIMER_CH2|JSH_TIM­ER_NEGATED/ 2 Uses /, 0 } },
    /
    PB1 / { JSH_PORTB, JSH_PIN0+1, JSH_ANALOG1|JSH_ANALOG_CH16, { JSH_AF1|JSH_TIMER1|JSH_TIMER_CH3|JSH_TIM­ER_NEGATED/ 2 Uses /, 0, 0 } },
    /
    PB3 / { JSH_PORTB, JSH_PIN0+3, JSH_ANALOG_NONE, { JSH_AF6|JSH_SPI3|JSH_SPI_SCK/ 1 Uses /, JSH_AF9|JSH_I2C2|JSH_I2C_SDA/ 1 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_SCK/ 3 Uses / } },
    /
    PB4 / { JSH_PORTB, JSH_PIN0+4, JSH_ANALOG_NONE, { JSH_AF4|JSH_I2C3|JSH_I2C_SDA/ 1 Uses /, JSH_AF6|JSH_SPI3|JSH_SPI_MISO/ 1 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_MISO/ 3 Uses / } },
    /
    PB5 / { JSH_PORTB, JSH_PIN0+5, JSH_ANALOG_NONE, { JSH_AF6|JSH_SPI3|JSH_SPI_MOSI/ 1 Uses /, JSH_AF7|JSH_USART1|JSH_USART_CK/ 2 Uses /, JSH_AF5|JSH_SPI1|JSH_SPI_MOSI/ 3 Uses / } },
    /
    PB6 / { JSH_PORTB, JSH_PIN0+6, JSH_ANALOG_NONE, { JSH_AF4|JSH_I2C1|JSH_I2C_SCL/ 2 Uses /, JSH_AF7|JSH_USART1|JSH_USART_TX/ 2 Uses /, JSH_AF14|JSH_TIMER16|JSH_TIMER_CH1|JSH_T­IMER_NEGATED/ 2 Uses / } },
    /
    PB7 / { JSH_PORTB, JSH_PIN0+7, JSH_ANALOG_NONE, { JSH_AF4|JSH_I2C1|JSH_I2C_SDA/ 2 Uses /, JSH_AF7|JSH_USART1|JSH_USART_RX/ 2 Uses /, 0 } },
    /
    PC14 / { JSH_PORTC, JSH_PIN0+14, JSH_ANALOG_NONE, { 0, 0, 0 } },
    /
    PC15 / { JSH_PORTC, JSH_PIN0+15, JSH_ANALOG_NONE, { 0, 0, 0 } },
    /
    PH3 */ { JSH_PORTH, JSH_PIN0+3, JSH_ANALOG_NONE, { 0, 0, 0 } },
    };
    -->

    thanks any way for your help.

  • in Porting to new Devices
    Avatar for mdd

    Hi Gordon,

    bravo ! it works(with l476rg startup file). now the build passed, board flashed and LED blinking successfully. you are so helpful :)

    play a bit I find my favorite neopixel library is not working. by referring to other build, I ported the driver for STM32_LL, but either follow STM32 or WIO_LTE approach, it's not working.

    check further, WIO_LTE approach drive GPIO directly with specific timing, STM32 use SPI(16bit then send 4bit), both are not working on B5(SPI1 MOSI), use B4(SPI1 MISO), can turn the LED constant on, so seems SPI is working. the error message for STM32 approach is "no suitable SPI device found for this pin", for WIO_LTE approach is no response.

    I tried to use SPI directly(like SPI1.send4bit([255,0,0], 0b0001, 0b0011)), it's not working and the error message is : SPI.send4bit only work on hardware SPI.

    any idea or hint for this ?

    thanks.

  • in Porting to new Devices
    Avatar for mdd

    Hi,

    I got a tiny board(nucleo-l432kc), just need a micro-usb cable to power, com and flash code as drag & drop, but with 256k flash and 64k ram. so I'm trying to port Espruino on it as it's convenient to carry and play, or use it to prepare some funny toys for the kid :)

    but the process is painful :( I modified the files use nucleol476rg as reference, cleared out many compilation errors due to the differences between l476 and l432(pinutils.py, jshardware.c etc.), but during link stage, I met a strange error :

    LD espruino_1v94.3387_nucleol432kc.elf
    _init' referenced in section.text.__libc_init_array' of /usr/local/gcc-arm-none-eabi-6-2017-q2-u­pdate-mac/bin/../lib/gcc/arm-none-eabi/6­.3.1/../../../../arm-none-eabi/lib/thumb­/v7e-m/libc.a(lib_a-init.o): defined in discarded section `.init' of /usr/local/gcc-arm-none-eabi-6-2017-q2-u­pdate-mac/bin/../lib/gcc/arm-none-eabi/6­.3.1/thumb/v7e-m/crti.o
    collect2: error: ld returned 1 exit status

    seems it's due to build_linker.py put below stuff into discard :

    /* Remove stuff we don't want /
    /
    we don't call init and fini anyway. GCC 5.x starting added them but then optimising them out */
    /DISCARD/ :
    {

    *(.init)
    *(.fini)
    libc.a ( * )
    libm.a ( * )
    libgcc.a ( * )
    

    }

    after move *(.init) under linker FLASH or RAM section, for example as below :

    codeOut("""

    . = ALIGN(4);
    *(.text)  
    *(.text*) 
    *(.rodata)  
    *(.rodata*)
    *(.init)
    
    . = ALIGN(4);
    _etext = .;
    

    } >FLASH

    the build is passed :

    LD espruino_1v94.3387_nucleol432kc.elf
    GEN espruino_1v94.3387_nucleol432kc.lst
    GEN espruino_1v94.3387_nucleol432kc.bin
    GEN espruino_1v94.3387_nucleol432kc.hex
    bash scripts/check_size.sh espruino_1v94.3387_nucleol432kc.bin
    PASS - size of 241360 is under 241664 bytes

    after flash the board, use WebIDE I can connect the board successfully, but can't interact with the console(REPL - enter 1+1 and get the response).

    by write a simple code like digitalWrite(LED1,1) and upload, I do not get the famous Espruino logo and copyright note, but an error message - ERROR: Prompt not detected - upload failed. Trying to recover...

    anyone with similar experience ? any hint to potential issue behind ? I doubt the build is passed but actually something wrong for the remap of *(.init)...

    what's the reason behind that l476 do not need crti.o from .init(the c-runtime environment) but l432 do?

    the default console is EV_SERIAL2, default_console_tx is A2 and default_console_rx is A15 referring to nucleo-l432kc board schematic.

    thanks

Actions