Hello,
I'm using a mcxc144 connected over i2c on a embedded Linux arm64 host. For test purpose I made a firmware that runs well on the mcxc144 and who is able to communicate as a salve on i2c with the Linux host. For now, I flash the firmware with a jlink probe directly from my Windows development machine.
My goal is to flash the mcxc144 directly from the embedded Linux through i2c. As I understand this is possible with the build-in bootloader, but I'm facing some issues.
-When the mcxc144 is erased, it does not seem to start on bootloader (I can't see it on the i2c bus)(I have also tried with the NMI pin high and low but it is the same)
-When my firmware is running, I make an i2c command to force it to run into the bootloader (a simple jump to 0x1c000000). At this point I have two behaviors :
->If I do nothing, I see the mcxc144 on the i2c bus with the address 0x10 (which is the default bootloader address) for 5 seconds (which is the default timeout to enable a bootloader peripheral) and then, nothing, the mcxc144 is frozen.
->During these 5 second, if I send the ping packet, the sending command fail but at the end, the mcxc144 reboot on my firmware.
I have tried to download the SPDSK to use blhost, but it does not support i2c programming.... I have also built an older blhost version that supports i2c but it does the same thing as when I manually send the ping packet.
Well, I thought I would have been an easier task, but I'm a little lost right now.
Any idea or comments ?
Solved! Go to Solution.
Hello,
Just a quick feedback, i2c programming is working with our new PCB. We put a stronger pull-up resistor and add a delay between powering up the galvanic isolators and the mcxc144.
Now I can use blhost 2.6.2 to load .hex file : blhost -i /dev/i2c-2 flash-image /lib/firmware/myFirmware.hex
Best regards,
Thanks for the reply, I will check the frdm board. On our design, the mcxc144 is behind a galvanic isolator, we have had issue with the i2c communication. The i2c pin configuration is maybe not exactly the same in bootloader mode. Furthermore the mcxc144 is not alone on the i2c bus, this maybe does not help.
blhost, in the SPSDK is looking for USB i2c bridges, not directly native i2c bus on Linux. here is the error :
blhost -l i2c,0x10,100 -- get-property 1
SpsdkNoDeviceFoundError: No devices for given interface 'usbsio_i2c' and parameters 'config=i2c,0x10,100, timeout=5000' was found.
Best regards,
Hi @romainmoura
I just want to follow up this, are you still facing problems ? Have you found something else in the meantime? As you mention about other devices on the bus, it migth be good for you to test with only the MCX on the bus.
Best regards,
Diego
Hello,
Just a quick feedback, i2c programming is working with our new PCB. We put a stronger pull-up resistor and add a delay between powering up the galvanic isolators and the mcxc144.
Now I can use blhost 2.6.2 to load .hex file : blhost -i /dev/i2c-2 flash-image /lib/firmware/myFirmware.hex
Best regards,
Hi @romainmoura
I am glad to know, thanks for sharing the outcome, I marked your response as the solution.
Diego
Hello,
I have tested the I2C connection with MCXC444 frdm and it works with the build-in bootloader. On the frdm boards I2C is provided via the on-board debugger serving as USB-to-I2C bridge between the host computer and the target MCU. To enable I2C on the frdm board 0 Ω resistors R78 and R79, and 2.2k Ω resistors R76 and R77 must be soldered. So maybe you can compere your solution with the frdm.
The SPSDK supports I2C programming I have used SPSDK 2.6.0 and blhost -l i2c,0x10,100 -- get-property 1.
ROM boot is configured in FOPT register in the Flash configuration fields. But that should not be an issue as after erase state should force ROM boot.
ROM can enable/disable peripherals based on the BCA config, after erase all peripherals are enabled as BCA is in invalid state.
Hope this helps.