Seeed-Studio / Lua_for_RePhone

http://www.seeed.cc/rephone/
15 stars 9 forks source link

No lua command prompt in debug port when connecting with PuTTY/minicom #1

Closed msva closed 1 month ago

msva commented 8 years ago

Hi there! Wiki article about Lua_for_Rephone on seeedstudio's site tells, then all is needed is just connect to debug port with PuTTY and there will be Lua command prompt, while where I trying to connect to both appeared ports, I get modem (with AT commands) in one of them, and tons of binary crap, if connect to another. Although, it is same exactly behaviour on RePhone's CreateKit 6.4 VXP. Only difference is there is working screen/touch on CreateKit's vxp, while don't on Lua_for_RePhone.

Can you help me (and not only me, according to rephone's forum) to fix it somehow and finally get Lua command prompt in debug port? :)

xiongyihui commented 8 years ago

Have you flashed a new firmware by following this - http://www.seeedstudio.com/wiki/Arduino_IDE_for_RePhone_Kit#Update.2FFlash_the_Firmware

msva commented 8 years ago

Unfortunatelly, not. I'm unavailable to update/reflash the firmware, since I have no Windows-powered machines everywhere, and it seems, there is no another way (isn't it?) to update firmware without Windows. So, I'm only able to "flash" VXPs using mass storage mode :(

msva commented 8 years ago

Also, I tried to make something like while true do audio.play("music.mp3") end in init.lua (which, seems to be autostarted by lua.vxp, as source code notices), and... there is silence after start. And after some time RePhone just freezing and stop to react even on PowerOff button. And, yes, music.mp3 is there, in the root of the storage device. And is played fine by both default RePhone Xadow 6.2 VXP and newer 6.4 one from github.

xiongyihui commented 8 years ago

Sorry for the lack of documentation. I will write some examples later. As the RePhone system is like event-driven system. We should not use while loop. Instead, we could use timer, for example:

function play_music()
    audio.play('music.mp3')
end
t = timer.create(10000, play_music)
msva commented 8 years ago

Ok, thanks, I'll try. And, talking about Lua console on debug-port: 1) is it known issue with debug port on "stock" firmware, or do you advice to upgrade just to have up-to-date fw? 2) isn't it any other way to upgrade firmware, except MTK's LinkIt Firmware Updater for Windows?

xiongyihui commented 8 years ago

1) To use the debug port, upgrading the firmware is required. 2) It seems no other way as MTK doesn't provide the source code or documents of the tool. We may try Wine on Linux.

msva commented 8 years ago

So sad :( All the times I tested, I never was successful on getting USB devices and even USB-COM ports working under Wine :(.

Although, maybe I'm doing something wrong...

msva commented 8 years ago

So, since your variant of music playing sketch seems to work pretty fine (although, I do not understand, why don't endless loop working there), it seems, that issue is not here (in Lua@Rephone project), but in RePhone itself. So, it looks like it can be closed, but I'm not sure, if it will prevent people from finding that issue with all the solutions, if they were experience same problem.

Maybe, it will be nice to note it (that Lua console on debug port is working only in fresh firmware, but does not on the stock one) in the README or on the wiki.

xiongyihui commented 8 years ago

Thanks for the feedback, a note is added in the README.md. On the wiki, updating firmware is noted, but it seems not obvious : (

Talking about endless loop, it wouldn't work because it makes the system unable to deal with other things, for example, responding the button pressed action.

Have you tried to update the firmware with Wine?

msva commented 8 years ago

1) thanks for the notes in documentation 2) thanks for explaination 3) Yup, I tried, but without any success: it does not see RePhone out of the box (it timeouts, and RePhone activates Mass Storage mode). I tried to link (with ln -s command) /dev/ttyUSB0 (which appears for a second, when plugging RePhone into USB, before Mass Storage Mode is activated, and then disappears) as ~/.wine/dosdevices/com2, but without any luck. It anyway timeouts, and RePhone anyway activating Mass Storage Mode.

And after all, I'm scared to brick RePhone if something will go wrong, if application will try to call something, that is not implemented by Wine ☹

But, I've found this: http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit_assist_2502/api_references/vm_firmware_trigger_update.gsp (and related things). So, it is, probably, possible to upgrade firmware from mass storage mode, using custom one-liner VXP sketch, but I'm a bit confused: documentation says

The path to the image must be "C:\image.bin"

But it is unclear to me what should be considered as "image" in RePhone case: exactly image.bin file from the RePhone/W15.19.p2-uart/ directory, which has size of 4.7M, or SEEED02A_DEMO_BOOTLOADER_V005_MT2502_MAUI_11CW1418SP5_W15_19.bin from same directory, which has size of only 7K, but it is mentioned in SEEED02A_DEMO_BB.cfg, which is mentioned on the wiki.

pirj commented 8 years ago

Any changes flashing with @WayenWeng 's W15.29 firmware (https://github.com/WayenWeng/RePhone_SDK_Bin_Update) ? I got init.lua file executing at least.

pirj commented 8 years ago

minicom -D /dev/cu.usbmodem1411 opens MT2502 modem interface:

AT+
ERROR

While minicom -D /dev/cu.usbmodem1413 doesn't echo.

PS Works fine with W15.19 firmware